Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Help With Random Movement?

Asked by
Scootakip 299 Moderation Voter
8 years ago
script.Parent.Zombie:MoveTo(Vector3.new(script.Parent.Torso.Position) + Vector3.new(math.random(-5,5),0,math.random(-5,5)))

this script is supposed to send the zombie to kinda wonder around randomly. It will go a few studs to X and a few studs to Z. But instead of that, it's trying to go the the coordinates that the math.random gets, rather than just add on to where it already is.... Help?

1 answer

Log in to vote
0
Answered by
XAXA 1569 Moderation Voter
8 years ago

You're trying to do Vector3.new(script.Parent.Torso.Position), and script.Parent.Torso.Position is already a Vector3. Just use it as-is:

script.Parent.Zombie:MoveTo(script.Parent.Torso.Position + Vector3.new(math.random(-5,5),0,math.random(-5,5)))
Ad

Answer this question