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

Why does this change the BackgroundColor3 to 50980?

Asked by 8 years ago

Can anyone tell me why this changes the BackgroundColor3 to 50980,50980,50980 instead of going from 200 to 199, 198 and so on?

for _,v in pairs(script.Parent:GetChildren()) do
    if v:IsA("TextBox") or v:IsA("TextButton") then
        v.MouseEnter:connect(function()
            for i = 1,20 do
                wait(0.1)
                v.BackgroundColor3 = Color3.new(200-i/255,200-i/255,200-i/255)
            end
        end)
    end
end

I know I can use v.BackgroundColor3 = Color3.new(180/255,180/255,180/255) or for TextButton's use AutoButtonColor, but I don't wanna do it that way.

Any help appreciated.

Answer this question