My aim is to create a system in which when both buttons have been clicked on and are green, clicking on the door will cause it to become transparent and unable to be collided with, "opening" it. Specifically, the two buttons start off red, and the player clicking on them turns them green; this part works fine, the door does not. In my code, I check whether the door is already transparent/uncollidable, and if it is not, then it checks if the buttons are green. If so, it will turn the door transparent/uncollidable; if not, it will remain opaque. Behold:
local door = game.Workspace.ButtonPuzzle.DoorObject.DoorUnion
local buttonOne = game.Workspace.ButtonPuzzle.Button1.ClickableButton1
local buttonTwo = game.Workspace.ButtonPuzzle.Button2.ClickableButton2
game.Workspace.ClickDetectorDoor.OnServerEvent:Connect(function()
if door.Transparency == 0 and door.CanCollide == true then
if buttonTwo.BrickColor == "Parsley green" and buttonOne.BrickColor == "Parsley green" then
door.Transparency = 1
door.CanCollide = false
else
end
else
door.Transparency = 0
door.CanCollide = true
end
end)
Whenever I run this code, despite both buttons being green, the door does not "open". When I removed the if statement checking for green, it allowed me to "open" and "close" the door. What am I doing wrong? Thank you

3 comments
Yes, it worked! Thank you so much :)
No problem, your defining the name of a Color so remember that!
Khosraux, if it helped you should really put VAHMPIN's awsner as the awsner. As a way of thanking VAHMPIN for helping you :=)