I've been wondering if there is a way to check through every player to see if they are standing inside a certain block. In this case the block would be filling the entire room, as that would check if they were in the room.
I'm able to cycle through a table containing each character, but I would like to know the event or function that can check if that character is touching the block, so that in turn I can check if they are in the room.
I know this way may be unpractical, but its the only way i see it could work using my lua knowlegde. Basicly, put an IntValue called Room in the StarterPlayer folder. Then put a localscript inside the StarterPlayer folder too.
Then use the Touched event inside an invisible part with no collision that you can put at the entrances of every room. Here's what to put in the local script.
local Bathroom = game.workspace.part --Change part with the name of the part to put in the entrance of the room. local function BathroomEnter() script.parent.Room = Bathroom end Bathroom.Touched:connect(BathroomEnter)
You can easily code a room with two or more entrances like so:
local Kitchen1 = game.workspace.part --Change part with the name of the part to put in the entrance of the room. local Kitchen2 = game.workspace.part local function KitchenEnter() script.parent.Room = Kitchen end Kitchen1.Touched:connect(KitchenEnter) Kitchen2.Touched:connect(KitchenEnter)