Pathfinding Issue!

I would like my NPC to move to a location, wait for 3 to 7 seconds and then move to another location. The issue is that when “moveRandomly” == true and “stop” == false, it runs the script but only once, after that, when it tries to run again, it skips the wait and just keeps repeating over and over again. This leads to the NPC attempting to move to loads of different locations simultaneously. I could provide video evidence if needed.

image

Might be an issue with the custom wait module you are using? You could just do this:

task.wait(math.random(3,7))
2 Likes

still the same issue with the task.wait as the customwait

Can you post the full script? Are you sure the function isn’t being fired in rapid succession once both if conditions are met?

2 Likes

can you post the full script on how all variables are being set

1 Like

Can you copy and paste the code, not make screenshots of it?

added a debounce and it fixed it lmao