How do I make the NPC teleport back to their original position if the NPC exceed the max distance that NPC can go.
This question is rather broad, you need to show an attempt. We don’t write script for you
You make an NPC teleport back to their original position if they exceed a distance by checking the displacement of the NPC from that position and then teleporting them back if the displacement exceeds the maximum allowed distance the NPC can travel from its original position.
The answer is in the question. Go work away at it. This category isn’t for having code written for you. Define your requirements and make an attempt first, debug it and try to fix it as much as you can in your own power and knowledge and if that doesn’t work, then feel free to post a thread.
As others have mentioned, this isn’t a place for free scripts.
However, here are some resources for helping:
- To find the position of an NPC, you can try:
- To teleport the NPC you can try: