I am adding buttons in my game that you can press which turn the button and screens red to indicate they were pressed. When all buttons are pressed, it should open a secret door and play a sound of the door opening. But when I tested it once I had pressed all the buttons the secret door did not open, is there anything wrong with the code?
if game.Workspace.Screen1.BrickColor == BrickColor.new("Really red") then
if game.Workspace.Screen2.BrickColor == BrickColor.new("Really red") then
if game.Workspace.Screen3.BrickColor == BrickColor.new("Really red") then
script.Parent.evad:Play()
wait(2)
script.Parent:Destroy()
end
end
end
The script detects if the screens are red (on) and then destroys itself after making the door opening noise. Evad is the sound of the door opening.

3 comments
Thank you! But at line 11 where it says until there is an error where the script expected end to close 'then' at line 7 but got until.
I edited my script! It should work now.
There was just a missing "end".