How to make NPCs walk in an area

I don’t really know on how to explain this and I also have no idea on how I could do something like this. But basically, I would like to make NPCs free roam in an area instead of having their path scripted. Is this possible? If so, how?

(visualization)

3 Likes

I guess that you can select a random position within your free roam area for your NPC to walk to. This article can help you with making your NPC walk to a given point: Character Pathfinding | Roblox Creator Documentation.

It kinda depens with your definition of ‘scripted’, cause there will always have to be some logic behind the NPC’s movement.

By scripted I mean that the NPC itself has more freedom when it comes to their movement. They will move inside their given area without really anything else, their movement is random instead of being “predictable”. I’m working on a city game and want to give the world more life and it would look weird when you add a bunch of NPCs with pathfinding who always walk perfectly in line. For example with the box, the NPCs spawn in the box. They stay in that box, you push them out of the box they walk back into it.

1 Like

Maybe you can use this method ‘Humanoid | Roblox Creator Documentation’. This way you can make the NPC walk in some random direction. Also, you can make him want to stay within the box with some maths.

1 Like

Thank you, I will look into this and when it helps mark it as solution.

1 Like

PS: Thanks for the fast commenting & reply!

2 Likes