Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why am I getting a clearly incorrect output from Color3?

Asked by 6 years ago
Edited 6 years ago

So I am simply trying to change the color 3 value of a brick and I am so confused. Every time I go to change it to a color it set itself to black. So I set a variable up for each color channel to see if I can find a problem, and I have.

I have a brick with a Color3Value and a Script in it. The Color3Value is set to 255,255,255 and here is the script's content:

red = (script.Parent.Var.Value.r/255)
green = (script.Parent.Var.Value.g/255)
blue = (script.Parent.Var.Value.b/255)
script.Parent.Color = Color3.new(red,green,blue)
print(red)

In theory, each variable should turn out as one, as 255 / 255 = 1, but according to the Output after I print "red", 255 / 255 = 0.003921568627451

I am so absurdly confused.

Proof that I am not going insane.

1 answer

Log in to vote
0
Answered by 6 years ago

That because the Value that it is, is already 1, not 255.

1/255 = .00392515

so try taking away the 255 maybe?

0
Yep, works perfectly. Thank you. ChaterBox12345 2 — 6y
Ad

Answer this question