Hello, I'm making a self-check-in system for a hotel game and I needed to store if the room is taken or not. For this, I made a Folder with BoolValues. For some reason, the script runs at the start but does not keep testing for the BoolValue. It goes off the starting value and not the updated one, but my print keeps printing.
Here are the scrips:
(0 = not taken | 1 = taken)
while true do if script.Parent.Value == 1 then game.ReplicatedStorage.RoomTaken["Room 101"].Value = true elseif script.Parent.Value == 0 then game.ReplicatedStorage.RoomTaken["Room 101"].Value = false wait(0.5) end end
2.
while true do if game.ReplicatedStorage.RoomTaken["Room 101"].Value == false then script.Parent.BrickColor = BrickColor.new("Medium green") print("Green") elseif game.ReplicatedStorage.RoomTaken["Room 101"].Value == true then script.Parent.BrickColor = BrickColor.new("Bright red") print("Red") wait(1) end end
Example, see if this works better
script.Parent.Changed:Connect(function() if script.Parent.Value == 1 then game.ReplicatedStorage.RoomTaken["Room 101"].Value = true print("True") elseif script.Parent.Value == 0 then game.ReplicatedStorage.RoomTaken["Room 101"].Value = false print("False") wait(0.5) end end)
game.ReplicatedStorage.RoomTaken["Room 101"].Changed:Connect(function() if game.ReplicatedStorage.RoomTaken["Room 101"].Value == false then script.Parent.BrickColor = BrickColor.new("Medium green") print("Green") elseif game.ReplicatedStorage.RoomTaken["Room 101"].Value == true then script.Parent.BrickColor = BrickColor.new("Bright red") print("Red") wait(1) end end)