How does color work in roblox?

Hello, I recently made a script for a game i’m working on.

ServerScript (ServerScriptService)

game.ReplicatedStorage.ColorChanger.OnServerInvoke = function(plr, color)

Local Script (StarterGui)

local remote = game.ReplicatedStorage:WaitForChild("ColorChanger")

	script.Parent.Text = "Colour changed."
	script.Parent.Text = "CHANGE LIGHT COLOUR"

Alright, so, for example if I select the color red, the output would be 1, 0, 0.0156863
What is this, what are those numbers? I googled it and it did not help at all.

Heads up: The color that is being printed is a .BackgroundColor3 property - which tends to be in RGB, not whatever those numbers was.

You change the value using Color3, but the value itself does not include a “3”.

1 Like

It basically prints the color in which is basically redValue/255, greenValue/255, blueValue/255, if you want a Color3.fromRGB value, just multiply by 255, the printed value is just your color / 255


And those numbers are the integer values for the colour, so use Color3.fromRGB if you want a colour in RGB format.


If you are editing a part you can use part.BrickColor = BrickColor.Red
That is an example for red sorry for the lack of detail I am on my phone.

1 Like

How would I multiply it by 255? I just tried

	local col = color * 255

and I got an error.

You would need to pull out the int values of the ego code then multiply them and add them back in.

Unfortunately Color3 doesn’t have __mul metamethod so c3 * num isn’t possible. Just do

local col = Color3.fromRGB(color.R*255, color.G*255, color.B*255)
1 Like

Also the values cannot go higher then 255.

1 Like

It doesn’t work that way. You are trying to multiply an instance. I think multiplying each value would work.

local col = color.R * 255

is how it works I believe. I don’t do this type of stuff much. Just use Color3.fromRGB. It’s much simpler.

(Idk why I sound strict, I don’t mean to be rude, sorry)

1 Like

you have to multiply every value by 255, like

local r = col.R * 255
local b, g = col.B * 255, col.G * 255

print("R: "..tostring(r).."\nB: "..tostring(b).."\nG: "..tostring(g))

I would just do
local r = 5*5
And do the same for g and b.

1 Like