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?
You have a deb variable but not putting it to use, so remove it or use it.
local click = script.Parent.ClickDetector click.MouseClick:Connect(function() script.Parent.BrickColor = BrickColor.new("Black") workspace.light12.BrickColor = BrickColor.new("White") wait(1) end) while wait(5) do print(game.workspace.light12.BrickColor) end