i am trying to make a brick that turns black when clicked and if it is black it will turn white when clicked.
i also wanted it to change a variable named “Number1” it is currently equal to 0.
so when the brick is black i want the number to be 1 and if it’s white it changes to 0.
it’s for a pattern which is equal to 0,1,0,1
and at the bottom of the script it checks if the player’s pattern is the same as that.
the script has no errors but still functions weird. when it is white it turns white when it is black it turns white i fixed that but now it only turns black
the number changes to 1 if its white and doesn’t even change to 0.
when i fixed the issue with the color it broke the number more since it now doesn’t even change.
quick recap of the problem:
-color only stays black
-number does not change.
script:
Part1.ClickDetector.MouseClick:Connect(function(plr)--Part1 = script.Parent.Part1
if Part1.Color == Color3.new(255,255,255) then--Color For White
Number1 = 1
print(Number1)
Part1.Color = Color3.new(0,0,0)--Black
else
Part1.Color = Color3.new(255,255,255)--White
Number1 = 0
print(Number1)
end
end)