Moved your post as its own topic since it's fairly generic and was grave digging/off topic for something to be posted in a shared script.
You'll need to share what you are doing, what have you tried, and why they don't solve your problem. There's plenty of path finding scripts out there.
Also I think Ao Oni just uses the built-in follow player event movement pattern.