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
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.
Use region 3 and path finding