Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make npc walk to waypoints?

Hello, I want to make an npc walk to waypoints but the problem is that there are so many waypoints that typing them all out individually like this would take a long time

Humanoid:MoveTo(Waypoint1)
Humanoid:MoveTo(Waypoint2)
Humanoid:MoveTo(Waypoint3)

Is there any way i could just make npc walk to another waypoint without doing what i did earlier?

1 comment

0

I'd do it with a loop that counts down the number of waypoints until it's 0.

2 answers

✓ Accepted answer
local waypoints = {waypoint1, waypoint2, waypoint3}

for i, v in pairs(waypoints) do
	Humanoid:MoveTo(v)
	Humanoid.MoveToFinished:Wait()
end

You can wait until it finished walking to a waypoint by using Humanoid.MoveToFinished:Wait() for every Humanoid:MoveTo()

Humanoid:MoveTo(Waypoint1)
Humanoid.MoveToFinished:Wait()
Humanoid:MoveTo(Waypoint2)
Humanoid.MoveToFinished:Wait()
Humanoid:MoveTo(Waypoint3)
Humanoid.MoveToFinished:Wait()

1 comment

0

Don't believe that's what he's asking. He wants to prevent having to type them individually.

This discussion is preserved as it was. New answers, comments, and votes are closed.