So I’ve almost finished fully implementing this pathfinding algorithm in my game. The problem I’m having right now is that after around a minute of testing client-side any pathfinding NPC within a certain distance of my character will almost entirely cease to move. This only happens after some time. Also, my “area of effect” on the NPCs seems to increase in size as time goes on. To elaborate, 1 minute in I have to get closer to an NPC for them to experience this problem in contrast to around 2 where I don’t have to be as close to see the same effect. They will eventually move but only to the next node and only after a pretty long amount of time. I’ve run the game server-side only and it has absolutely no issues. In client-side testing I also checked to see if the server was seeing the same thing as me so I switched to server view and the NPCs were also in the same “frozen” state. To make it absolutely clear: only NPCs within a certain distance of me will have trouble moving. Anything far away has no problem. Even with only 1 NPC this issue will arise. I also destroyed the NPC and spawned a new one to see if the problem carried over and sure enough it did. Anyway, when the NPCs pathfind, they itterate through a table that includes all of the nodes to a finish node (the path). They use Humanoid:MoveTo(node_position) to move to the next node and will only move to the next node after Humanoid.MoveToFinished:Wait(). It seems that Humanoid.MoveToFinished:Wait() is either part of the problem or is at least the one succumbing to the problem based on some print tests. Humanoid.MoveToFinished:Wait() is the part that gets hung up more than it should. Absolutely no lag or errors. Here’s the issue visually:
This issue is absolutely beyond me at this point. I’ve been looking everywhere for something that addresses my problem, but have found nothing direct. I’ve seen that there are a lot of issues to do with Humanoids and things related though so I’m just praying that the issue is within my control. I will be happy to share code, I just wasn’t sure what parts would be relevant enough to paste into a block for. Any advice/help is much appreciated!