Chasing enemy NPC isn't able to catch up to the player

The chasing mechanic is as simple as you can imagine. A constant loop consisting of pathfinding and MoveTo calls.

Whenever the NPC gets to about 11 studs behind the player, it doesn’t really advance any more. Instead, it keeps it’s distance of 11 studs (occasionally it will seemingly collide with the player’s character, and slightly bounce back. Although on the client side, the NPC is ~11 studs away). Keep in mind, this happens when I’m actively running away from the NPC. If I stop moving, it does catch up.

The whole chasing mechanic is entirely server sided.

There is a post that resembles what I’m experiencing: NPC cannot catch up to player (I did not find the answers very useful though…)

1 Like

That is a weird issue, are you able to show the script?
It might be a distance check issue.

I’m still not exactly sure why it didn’t work before, but I have a partial solution. Before, the NPC was constantly using pathfinding. Even when it didn’t necessarily have to. So, instead, I made it so that the NPC goes straight to the player if there’s nothing inbetween them.

1 Like

Could you please provide the code? It’s challenging to solve the issue without understanding how your script works.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.