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

Script displaying Color.R, Color.G, Color.B as values divided by 255?

Asked by
lolzmac 207 Moderation Voter
4 years ago

While making a script that changes a GUI's text to a part's Color3 values using Color.R (3 separate text boxes), I noticed that it divided the number by 255 before displaying the value. I'm not sure why it does this but I also don't know how to fix it. I tried multiplying the value by 255 to get a more accurate value, but the value did not change at all. I'm not quite sure what I'm doing wrong. Here's a snippet of code that is supposed to fix the issue, that doesn't change it at all. The text isn't edited anywhere else inside the script, so I'm not quite sure what to do about it.

GrassRValue.Text = game.Workspace.Grass.Color.R * 255
GrassGValue.Text = game.Workspace.Grass.Color.G * 255
GrassBValue.Text = game.Workspace.Grass.Color.B * 255
0
Are this your full script? Send the entire script to us so we can fix. Make an edit on below your question. Thanks. Xapelize 2658 — 4y
0
Color.R is not a value that can be assigned to in that way ForeverBrown 356 — 4y
0
He's not assigning to Color.R EmilyBendsSpace 1025 — 4y

2 answers

Log in to vote
0
Answered by
Xapelize 2658 Moderation Voter Community Moderator
4 years ago

Your script makes a mistake.

game.Workspace.Grass.Color

Color is not a valid member of 'Grass'. You can try to make that the 'BrickColor.Color3' instead of using 'Color',

Have a nice day and happy coding :) If you have any question, comment below :D

0
Parts have a Color property that is a Color3 value.Part.Color is fine. Part.Color3 would error. EmilyBendsSpace 1025 — 4y
Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Well here is a thing..

a value RGB goes from 0 to 255, anything below or over 255 is invalid RGB value.. therefore, doing 255*X with X being a number that's not 1 will return an invalid value..

whenever you enter an invalid RGB value, Roblox doesn't raise an error..

here is an example of how to make colors with RGB

red,(no green,no blue) => RGB(255,0,0)

Red color

(no red), green, (no blue) => RGB(0,255,0)

Blue color

(no red,no green), blue => RGB(0,0,255)

Blue color

NOTE: these color examples might not be 100% accurate.

to access an RGB value of a brick in roblox, you do -

print(brick.Color3)

by combining different amount of red,green and blue we can make any color..

GOOD luck

Answer this question