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

MoveTo doesn't work correctly on all waypoints?

Asked by 2 years ago

I'm trying to make an NPC go around using waypoints (1-9). It does well the first 4 waypoints and starts going towards the 5th but half the way there the NPC starts going to waypoint 6. My code:

local waypoints = game.Workspace.Paths:GetChildren()

for waypoint=1, #waypoints do
    script.Parent:MoveTo(waypoints[waypoint].Position)
    script.Parent.MoveToFinished:Wait()
end
1
Try getting each of the waypoints named in order for example: waypoint1, waypoint2, waypoint3, waypoint4, waypoint5, waypoint6, waypoint7, waypoint8, waypoint9. RektwayYTB 123 — 2y
0
Fixed, thanks! Mafincho 43 — 2y

Answer this question