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
script.Parent.ClickDetector.MouseClick:Connect(function()
    local brck = script.Parent.Color == Color3.fromRGB(255,255,255)
for i = 1, 255 do
    brck = brck - Color3.fromRGB(1,1,1)
    wait()
end
end)

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

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

You have to write

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

Then

script.Parent.ClickDetector.MouseClick:Connect(function()
local brck = script.Parent.Color
brck = Color3.fromRGB(255,255,255)
for i = 1, 255 do
    brck = brck - Color3.fromRGB(1,1,1)
    wait()
end
end)

Answer this question