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

How do I make a humanoid "wander"?

Asked by 10 years ago

So for my RPG game I want to add animals that you can kill. I think it'd be boring if they never moved. So how do i make the humanoid walk around aimlessly?

1 answer

Log in to vote
1
Answered by
Tesouro 407 Moderation Voter
10 years ago

There is this perfect method for you: MoveTo (wiki) This script will make the animal walk randomly 50 studs around him every 5 seconds, just for an example.

-- animal will be the humanoid of the animal character
while true do
    animal:MoveTo(Vector3.new(math.random(-50, 50), 0, math.random(-50, 50)) -- change the Y positions to fit your game
    wait(5) -- set the time to wait
end
Ad

Answer this question