while true do script.Parent.WalkToPoint = script.Parent.Parent.Parent.PointB.Position wait(3) script.Parent.WalkToPoint = script.Parent.Parent.Parent.PointA.Position wait(3) script.Parent.WalkToPoint = script.Parent.Parent.Parent.PointC.Position wait(3) script.Parent.WalkToPoint = script.Parent.Parent.Parent.PointD.Position wait(3) script.Parent.WalkToPoint = script.Parent.Parent.Parent.PointE.Position wait(3) end
Ok, so I obviously want the NPC to move to these paths.
But, for some reason, when the NPC is moving to say A to C, after about 3 seconds, the NPC starts to move to D without first reaching C!
Could someone help me to where the NPC will complete his path, and then move to the next point instead of just stopping midway?
Thanks!
The humanoid will walk to D after three seconds, just like you told it to. It does not care if it already reached C, because it has new commands. You could fix this using a repeat loop, line Luna said, but it may make a difference based on the size of the brick
repeat wait() until script.Parent.Parent.Torso.Position == workspace.PointE.Position --This assumes that script.Parent is the Humanoid and script.Parent.Parent is is the character model.
You could also use magnitude to check if the torso is a certain distance away from the part. This would be useful if the part's y position is above or below the torso's y position, and therefore they would never exactly equal eachother.
repeat wait() until (script.Parent.Parent.Torso.Position - workspace.PointE.Position).magnitude <= 5 --This assumes that script.Parent is the Humanoid and script.Parent.Parent is is the character model.
Hope i helped!