Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

attempt to perform arithmetic on bool value?

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

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 "=="

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.