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

how can i make a textlabel display the proper r,g and b values of a part?

Asked by 3 years ago

i'm making a machine that tells you the color of the part that another brick is touching but it always brings out a non exact number (like 0.35.. instead of something like 128)

is there a way to make it display the exact rgb values? this would be really useful because it's the last thing i need to complete this, this is the current code i'm using

    screen.R.Text = hit.Color.R
    screen.G.Text = hit.Color.G
    screen.B.Text = hit.Color.B

could anyone here help me with this? it would be really useful

0
Couldn't you just use brickcolor instead to tell the color of the Part? KripticalYT 100 — 3y

2 answers

Log in to vote
5
Answered by 3 years ago

You would just mutiply the R, G, B values by 255.

screen.R.Text = hit.Color.R * 255
screen.G.Text = hit.Color.G * 255
screen.B.Text = hit.Color.B * 255

Ad
Log in to vote
0
Answered by 3 years ago

try this, i have never done somethink like that before but it may work

screen.R.Text = tostring(tonumber(hit.Color.R))
screen.G.Text = tostring(tonumber(hit.Color.G))
screen.B.Text = tostring(tonumber(hit.Color.B))

Answer this question