so for some reason when I change a button's background color with
this script
local player = game.Players.LocalPlayer local button = script.Parent script.Parent.MouseEnter:connect(function(over) button.Size = UDim2.new(0, 210, 0, 50) button.BackgroundColor3 = Color3.new(0, 255, 0) button.Position = UDim2.new(0, 15, 0.6, 0) end) script.Parent.MouseLeave:connect(function(over) button.Size = UDim2.new(0, 200, 0, 50) button.Position = UDim2.new(0, 0, 0.6, 0) button.BackgroundColor3 = Color3.new(27, 42, 53) end)
after my mouse leave event fires the button is white and has a color3 value of
6885, 10710, 13515 what causes this and how do I fix it?
Color3 is a [0-1] float
The whole idea of colours being out of 255 is wrong. It's a convenience made by the ability to represent it easily in the form of 8 bytes. In terms of colour theory, it's a terrible representation, and therefore most engines benefit from internally representing it as a float or double. As a result, you'll need to make all your values range from 0 to 1