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

Color3 value showing wrong value?

Hi there, so I have this problem where my color3 value is showing as 0.666667, 0.239216, 0.498039 when it SHOULD be 170, 61, 127. I've checked the value in case it was set as anything else but it's definitely a Color3Value, here is the code I am using to get it.

wait(5)
local colors = game.Workspace:WaitForChild("ControlBoard").Board.ControlBoard.Background.Settings.Color
local colorv = colors.value

print(colors.value)

script.Parent.BackgroundColor3 = Color3.new(colorv)

1 answer

✓ Accepted answer

That's because when you print the value, it's actually printing the RGB components as a value from 0 to 1. The input you put in was as a value from 0 to 255, which translates into a number from 0 to 1. If you want to see it as a value from 0 to 255, simply multiply the components by 255.

print(colors.value.r * 255, colors.value.g * 255, colors.value.b * 255)

Hope this helps! :)

2 comments

0

Ahh, thanks, that explains the color always coming out as black, however multiplying them also turns the color black, do you know how to fix it?

0

I meant multiply the value if you want to /see/ what the value is out of 255 instead of out of 1. If you want to input a Color3 using 0-255 RGB values, use Color3.FromRGB(r, g, b).

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