generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Wonder script...

Previous Thread :: Next Thread 
kingmatt2 is not online. kingmatt2
Joined: 20 Aug 2011
Total Posts: 6494
22 Jun 2013 10:37 PM
This script is spose to make my Pig, Mr.Cibbles move/jump randomly.
But I can't figure out how to make it do that...



local MaxInc = 15
local Humanoid = script.Parent.Humanoid
while true do
wait(math.random(2, 6))
end

Humanoid:MoveTo(Torso.Position + Vector3.new(math.random(-MaxInc, MaxInc), 0, math.random(-MaxInc, MaxInc)), CurrentPart)
if math.random(1, 2) == 1 then
Humanoid.Jump = true
end
Report Abuse
kingmatt2 is not online. kingmatt2
Joined: 20 Aug 2011
Total Posts: 6494
22 Jun 2013 10:41 PM
Mr.Cibbles need to move people!
Report Abuse
kingmatt2 is not online. kingmatt2
Joined: 20 Aug 2011
Total Posts: 6494
22 Jun 2013 10:45 PM
Mr.Cibbles is getting mad.
Report Abuse
kingmatt2 is not online. kingmatt2
Joined: 20 Aug 2011
Total Posts: 6494
22 Jun 2013 10:46 PM
Mr.Cibbles is about to be eaten by a wolf! Hurry fix the script so he can run way!
Report Abuse
kingmatt2 is not online. kingmatt2
Joined: 20 Aug 2011
Total Posts: 6494
22 Jun 2013 10:49 PM
Mr.Cibbles got eaten...

TIme to make Mrs.Cibbels run way!
Report Abuse
kingmatt2 is not online. kingmatt2
Joined: 20 Aug 2011
Total Posts: 6494
22 Jun 2013 10:51 PM
Mr.Cibbles "Im dieing!!" "Dies"
Msr.Cibbles "NOOOOOO I MUST AGENVENGE YOU"
Mr.Cibbles "Dead"
Mrs.Cibbles "I must run"
Mrs.Cibbles "NOO I CANT"
Wolf "I will eat you Ha ha ha"
Report Abuse
XxLordJoshxX is not online. XxLordJoshxX
Joined: 14 Jun 2012
Total Posts: 1323
22 Jun 2013 10:53 PM
Actually, the wolf was a disguise. I ate him! :3

He was yummy! :P
Report Abuse
kingmatt2 is not online. kingmatt2
Joined: 20 Aug 2011
Total Posts: 6494
22 Jun 2013 10:53 PM
... Just please fix it?
Report Abuse
SamuelKingx is not online. SamuelKingx
Joined: 27 Jan 2012
Total Posts: 3472
22 Jun 2013 10:56 PM
What's 'CurrentPart'?
Report Abuse
kingmatt2 is not online. kingmatt2
Joined: 20 Aug 2011
Total Posts: 6494
22 Jun 2013 10:57 PM
Its half free models okay....? I tried...


Its spose to make my pig move randomly give my a brake please...
Report Abuse
kingmatt2 is not online. kingmatt2
Joined: 20 Aug 2011
Total Posts: 6494
22 Jun 2013 10:59 PM
local CurrentPart = nil
local MaxInc = 15
local Humanoid = script.Parent.Humanoid
while true do
wait(math.random(2, 6))
end

Humanoid:MoveTo(Torso.Position + Vector3.new(math.random(-MaxInc, MaxInc), 0, math.random(-MaxInc, MaxInc)), CurrentPart)
if math.random(1, 2) == 1 then
Humanoid.Jump = true
end
Report Abuse
kingmatt2 is not online. kingmatt2
Joined: 20 Aug 2011
Total Posts: 6494
22 Jun 2013 11:03 PM
THE PIGS NEED YOU!
Report Abuse
RoAnt is not online. RoAnt
Joined: 14 Jul 2008
Total Posts: 16794
22 Jun 2013 11:06 PM
"CurrentPart" can not be nil.

Your "while" loop stop the code from continuing.

The variable "Torso" is not define.


Report Abuse
kingmatt2 is not online. kingmatt2
Joined: 20 Aug 2011
Total Posts: 6494
22 Jun 2013 11:08 PM
This works but its full of trash so I tried to shorten it.


local CurrentPart = nil
local MaxInc = 15

function onTouched(hit)
if hit.Parent == nil then
return
end

local humanoid = hit.Parent:findFirstChild("Hunt")

if humanoid == nil then
CurrentPart = hit
end
end

function waitForChild(parent, childName)
local child = parent:findFirstChild(childName)

if child then
return child
end

while true do
print(childName)

child = parent.ChildAdded:wait()

if child.Name==childName then
return child
end
end
end

local Figure = script.Parent
local Humanoid = waitForChild(Figure, "Hunt")
local Torso = waitForChild(Figure, "Torso")
local Left = waitForChild(Figure, "Left Leg")
local Right = waitForChild(Figure, "Right Leg")

Humanoid.Jump = false

Left.Touched:connect(onTouched)
Right.Touched:connect(onTouched)

while true do
wait(math.random(2, 6))

if CurrentPart ~= nil then
if math.random(1, 2) == 1 then
Humanoid.Jump = true
end

Humanoid:MoveTo(Torso.Position + Vector3.new(math.random(-MaxInc, MaxInc), 0, math.random(-MaxInc, MaxInc)), CurrentPart)
end
end
Report Abuse
kingmatt2 is not online. kingmatt2
Joined: 20 Aug 2011
Total Posts: 6494
22 Jun 2013 11:13 PM
Im not going to stop bumping this script so unless you help me it wont go away.
Report Abuse
kingmatt2 is not online. kingmatt2
Joined: 20 Aug 2011
Total Posts: 6494
22 Jun 2013 11:17 PM
............
...........
........'
........
......
..
...
....
.
.
.
. BUMP!!!!!!!!!!!!!!!!!!!!!
Report Abuse
RoAnt is not online. RoAnt
Joined: 14 Jul 2008
Total Posts: 16794
22 Jun 2013 11:34 PM
UGH...

local MaxInc = 15

while true do
wait(math.random(2, 6))
local Torso = script.Parent:FindFirstChild("Torso")
local Humanoid = script.Parent:FindFirstChild("Humanoid")
if Torso and Humanoid then
Humanoid:MoveTo(Torso.Position + Vector3.new(math.random(-MaxInc, MaxInc), 0, math.random(-MaxInc, MaxInc)), Torso)
if math.random(1, 2) == 1 then
Humanoid.Jump = true
end
end
end
Report Abuse
masterblokz is not online. masterblokz
Joined: 17 Nov 2010
Total Posts: 9517
22 Jun 2013 11:57 PM
Shut up
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image