For my game I’m trying to make a script which detects what room of the house you are in. So far I have done this: I first started placing blocks that are the size of the room they are in. I gave them all a script, so when the part gets touched it enables a boolean. Now what I’m trying to figure out is how to only have one boolean activated at a time. What happens with my current script is that each room you walk into the boolean gets enabled and never disabled, and I want to make it so when you step in another room the script of the room-detecting part is fired and enables its own boolean, while disabling every other boolean.
Here is my current code:
local part = script.Parent
local check = part.Parent.Bools:GetDescendants()
local bool = script.Parent.Parent.Bools:FindFirstChild(part.Name)
function InRoom()
bool.Value = true
print("Player is in", part.Name)
local function Check()
-- I don't know what to do here
end
end
part.Touched:Connect(InRoom)
I don’t know how to do this, I’m not very experienced at scripting yet. I’m also not 100% sure if this is the right way to go about it, so I’ll be thankful for any help.