PathFindingService NPC Doesn't reach the end

I’m trying to make a game where these NPCs need to move from one point to another. The issue is that depending on the NPC’s WalkSpeed , it doesn’t always reach the end point. I’m not sure why this happens as I’m sure PathFindingService takes WalkSpeed into account when calculating the time it needs to take to reach the point.

As you can see here, an NPC with 16 WalkSpeed will reach the end fine. However, the ones with a lower WalkSpeed won’t get to the end.
https://gyazo.com/ea82da9c0500260cecaf8ca2638e6ef0

NPC.Humanoid:MoveTo(tiles[tostring(self.Lane)].End.Position)
NPC.Humanoid.MoveToFinished:Wait()
-- NPC has stopped moving

I’m unsure why PathFindingService is not taking WalkSpeed into account. Is there any way around this?

MoveToFinished will be fired after 8 seconds MoveTo doesn’t finish. The humanoid at a slower speed will take over 8 seconds so it just stops.
You can counter this with a while loop that checks if the humanoid’s position is at the end. If it doesn’t reach, then run moveto again.

3 Likes

Ah I didn’t know that MoveToFinished was fired after 8 seconds, just fixed it.

Thanks for all the help!