Hello,
I’m having a problem where I am running a while loop and creating a path (using PathFindingService) inside the while loop so that if a player moves it keep following them.
Problem:
I have ran into a problem where my NPC is getting stuck in place even though the path is being calculated. Sometimes with different variations of my code the NPC moves an inch every time. (I believe due to the while loop creating a path every second the bot is glitching).
Solutions I have tried:
- Moving the pathfinding block of code outside of the while loop.
- Using a nested while loop inside a for loop - so that it only runs once.
- Using a debounce system to allow the bot to move all the way (not the best with debouncing).