This is supposed to make it so that when you press a button light12 turns white
local db = true
local click = script.Parent.ClickDetector
click.MouseClick:Connect(function()
script.Parent.BrickColor = BrickColor.new("Black")
wait(1)
if script.Parent.BrickColor == "Black" then
game.workspace.light12.BrickColor = BrickColor.new("White")
end
end)
while wait(5) do
print(game.workspace.light12.BrickColor)
end
all the printing works but light12 won't change color. Why is that?

2 comments
Any error messages? (Also capitalize the "w" in workspace)
It's because you're trying to compare a brickcolor value with string at line 6. Replace the string with BrickColor.new("Black")