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

Could someone explain to me why that happens or the error I made?

Asked by 10 years ago

I was making a gui that when the mouse hovers over it the gui changes color, but when I try to hover the mouse over the gui the color doesn't match with what I was trying to do.

The color was suppose to be light purple but the result was pink for some reason..

script.Parent.MouseEnter:connect(function()
    script.Parent.BackgroundColor3=Color3.new(170, 0, 255)
    script.Parent.Font="Legacy"
    script.Parent.TextColor3=Color3.new(0, 0, 0)
script.Parent.MouseLeave:connect(function()
    script.Parent.BackgroundColor3=Color3.new(0, 0, 0)
    script.Parent.Font="ArialBold"
    script.Parent.TextColor3=Color3.new(170, 0, 255)

end)
end)

1 answer

Log in to vote
1
Answered by 10 years ago

When using Color3, you need to divide each number by 255

So your script should look like:

script.Parent.MouseEnter:connect(function()
    script.Parent.BackgroundColor3=Color3.new(170/255, 0/255, 255/255)
    script.Parent.Font="Legacy"
    script.Parent.TextColor3=Color3.new(0/255, 0/255, 0/255)
script.Parent.MouseLeave:connect(function()
    script.Parent.BackgroundColor3=Color3.new(0/255, 0/255, 0/255)
    script.Parent.Font="ArialBold"
    script.Parent.TextColor3=Color3.new(170/255, 0/255, 255/255)

end)
end)

Ad

Answer this question