Color3 new not converting to RGB properly?

I want to convert to Color3.fromRGB (I’m more comfortable with fromRGB). I was able to get the right method of converting with some help, but Studio still reads it as a
My code:

local toAdd =, 0, 0)
for i, v in pairs(color.Keypoints) do
	toAdd =, toAdd.G+v.Value.G, toAdd.B+v.Value.B)
local r = ((toAdd.R*255)/#color.Keypoints)
local g = ((toAdd.G*255)/#color.Keypoints)
local b = ((toAdd.R*255)/#color.Keypoints)
print(r, g, b, "Expected output") --Expected output
local returnThis = Color3.fromRGB(r,g,b)
print(returnThis.R, returnThis.G, returnThis.B, "Returned") --What is given


 11:54:48.571 | 205.06323158741 144.5982465148 205.06323158741 Expected output  -  Client - MainModule:46
 11:54:48.571 | 0.8041695356369 0.56705194711685 0.8041695356369 Returned  -  Client - MainModule:48

I believe this is because Color3 properties still use the range.

Is there any way to fix this? I set it to Color3.fromRGB(r,g,b) in my code above, why is it still reading as

Because that’s just how Color3s work, fromRGB just converts from the 0-256 range to the 0-1 range. If you want the 0-255 value, either convert it back or use the r, g, and b variables you already have.

really? so I have to use instead when returning it???

No, you can use fromRGB to construct the color3.

So basically fromRGB is just like a function that turns it to a

1 Like