Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

attempt to perform arithmetic on bool value?

Asked by 5 years ago
1script.Parent.ClickDetector.MouseClick:Connect(function()
2    local brck = script.Parent.Color == Color3.fromRGB(255,255,255)
3for i = 1, 255 do
4    brck = brck - Color3.fromRGB(1,1,1)
5    wait()
6end
7end)

gives error mentioned in title

2 answers

Log in to vote
0
Answered by 5 years ago

Can I ask why you're attempting to set its color in the same line of you defining it? Thats changing its value into a boolean because you used "=="

Ad
Log in to vote
0
Answered by 5 years ago

You can't write

1local brck = script.Parent.Color == Color3.fromRGB(255,255,255)

You have to write

1local brck = script.Parent.Color
2brck = Color3.fromRGB(255,255,255)

Then

1script.Parent.ClickDetector.MouseClick:Connect(function()
2local brck = script.Parent.Color
3brck = Color3.fromRGB(255,255,255)
4for i = 1, 255 do
5    brck = brck - Color3.fromRGB(1,1,1)
6    wait()
7end
8end)

Answer this question