Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

i need to make a npc/noob randomly wander around my map?

i tryed to find how to do it i tryed lots but it just walks to the edge of the map

my code is this

while true do script.Parent.NPC:MoveTo(Vector3.new(math.random(-820, 840), 0, math.random(-820, 840)), game.Workspace.Terrain) for i= 1,10 do wait(0.5) script.Parent.Head.RakeStep:Play() end wait(5) end

with my map its not working can i have help???

2 comments

0

game.Workspace.Terrain fulfills the 2nd parameter of MoveTo(), which sets the property of Humanoid.MoveToPart to the terrain in Workspace. The reason why it is moving to the edge is because the edge is the only reasonable location to walk upon the terrain to. If you leave said parameter nil and edit the X, Y and Z values in accordance with the terrain's main position, the script should work.

0

Use region 3 and path finding

1 answer

✓ Accepted answer
while true do
script.Parent.NPC.Humanoid:MoveTo(Vector3.new(math.random(-820, 840), 0, math.random(-820, 840)))--Sorry you would have to manually enter the size of your terrain.
for i= 1,10 do wait(0.5) 
script.Parent.Head.RakeStep:Play() end 
wait(5)
 end

I don't know if this works or not

5 comments

0

how do i know that oof

0

o and is that is studs? +i cant find the plate i used for it

0

should i make a new map or not?

0

I don't know. Its not my game.

This discussion is preserved as it was. New answers, comments, and votes are closed.