Avoiding NPC help

What do you want to achieve?
I would like an NPC that avoids players without running into a wall. (Runs away from players, but doesn’t get stuck running into a single wall.)

What is the issue?
Everything, I think I know how to avoid the player, but I can’t figure out how to avoid walls as well.

What solutions have you tried so far?
I can’t figure out a valid solution, I need ideas as to how I can do it.

1 Like

In order for rigs to go around walls. You would have to move the rigs using Pathfinding. However making this can get really complicated. Lucky for you I have made SimplePath, a module used to easily pathfind and more.

1 Like

I am actually proficient enough with lua to make my own. I am just out of ideas as to how to avoid walls WHILE avoiding players as well.

You can set up some vector positions around a map. If the humanoid wants to run, get the furthest point from the client character and run to it. Then loop.

You can even check if the magnitiude gets close to a small number like 2, cancel the running path and create a new path more further.