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

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

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

✓ Accepted answer

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)

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