It's best to simply make a clean, organized function to "wait" for a humanoid to reach its destination. You can use this:
function WaitUntilAtDestination(humanoid)
local torso = humanoid.Parent
if torso.Parent then
repeat wait() until (torso.Position - humanoid.TargetPoint).magnitude <= 2.5
end
end
Workspace['Test AI'].Humanoid:MoveTo( Vector3.new(0,0,0), Workspace.Baseplate )
WaitUntilAtDestination( Workspace['Test AI'].Humanoid )
Workspace['Test AI'].Humanoid:MoveTo( Vector3.new(10,0,10), Workspace.Baseplate )
It's easy to use as many times as you need:
Workspace['Test AI'].Humanoid:MoveTo( Vector3.new(0,0,0), Workspace.Baseplate )
WaitUntilAtDestination( Workspace['Test AI'].Humanoid )
Workspace['Test AI'].Humanoid:MoveTo( Vector3.new(13,5,10), Workspace.Baseplate )
WaitUntilAtDestination( Workspace['Test AI'].Humanoid )
Workspace['Test AI'].Humanoid:MoveTo( Vector3.new(11,0,0), Workspace.Baseplate )
WaitUntilAtDestination( Workspace['Test AI'].Humanoid )
Workspace['Test AI'].Humanoid:MoveTo( Vector3.new(32,0,5), Workspace.Baseplate )
1 comment
None of the answers received worked out with at least 4 destinations. Two of the scripts had the same mistake of pointing the script to the wrong direction, as well. local torso = humanoid.Parent & local humanoid = workspace["Test AI"]