Having an NPC travel to a room and stay within the bounds?

Was wondering how I would have an NPC travel to their designated room but have them stay within the bounds of said room. I could acomplish this by using a single invisible part but on a massive scale (which is what I am planning to do) I am worried this could cause some performance issues.

For them staying within the bounds I am not too sure about. I have an idea of calculating the CFrame of them model and removing x amount from the models size but not too sure.

My goal is to have a little parts as possible needed to accomplish this. My rooms are going to be models with parts within just to give you more of an idea of how to think of this.

I am not sure what you mean, but you can make them stay inside the room be teleporting them back if they get out of bounds, or you can clamp their position so it stays inside the room.

1 Like

It helps a ton if you’ve played Prison Architect before. Hopefully this provides more context.

I will link a youtube video below.

1 Like

If you want the prisoners to walk around inside the cell then you can get a random position inside the cell and use Humanoid:MoveTo() or using pathfinding (I recommend using pathfinding), I am not sure if you want the prisoners to go to different areas depending on the time, if so then you can also use Humanoid:MoveTo() or using pathfinding to make them go to the area after some time and then make them move around randomly in that area.

1 Like

Dont worry about this as I will expand my needed functions ontop of it once in place.

I will have a look at that pathfinding. Thanks.

1 Like

No problem, if you are having any problems feel free to ask me.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.