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

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

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

1 comment

0

Couldn't you just use brickcolor instead to tell the color of the Part?

2 answers

✓ Accepted answer

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

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))

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