I'm making a script that randomly moves an NPC to different points around the map; how would I implement a wait that would wait for the NPC to reach the location until it finds another location and moves there?
Here is the script (placed inside the NPC humanoid):
local humanoid = script.Parent
local points = workspace.Points:GetChildren()
while wait() do
local randompoint = points[math.random(1,#points)]
script.Parent:MoveTo(randompoint.Position)
end

3 comments
ahhhh i knew it was something like that - thanks bro
well i would recommend using repeat becuse its a forever loop and you will only be able to move one point
while true do is also a forever loop, and its doing a random position from a points array, which is probably more than 1 node for moving in.