How can I make only 1 NPC move to one part?

How could I make it so only 1 NPC is in that part at once? I would not like 2 NPCs in the exact same area tho. Thank you!

Create a table:

npc_paths = []

Let’s say you cycle through parts in a folder and choose a random one.

npc_paths.insert(part)

This makes it so that you can easily add an if statement to check if an NPC is already making their way to the path or not.

if npc_paths.find(part) then
   print("Part is occupied!")
else:
   --cycle through the parts again

I haven’t coded in around half a year, as I am learning another language. Sorry if I missed some things or didn’t have proper syntax, this was just meant to serve as a rough draft and an idea for your situation. :sweat_smile:

3 Likes

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