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

what's the color of green selectionbox using script?

(15, 124, 7)--- this is supposed to be the color of green selectionbox i tested it on a brick with selectionbox, but whenever i use that color it just gives me white

selectionBox = Instance.new("SelectionBox") selectionBox.Adornee = mouse.Target.Parent selectionBox.Color3 = Color3.new(15, 124, 7)

selectionBox.Parent = camera

1 comment

0

Color3.new(0,1,0) -- That's going to be green. Color3 values are RGB, although the maximum is 1 when it comes to this.

3 answers

✓ Accepted answer

There are multiple ways to create Color3 values:

  • Color3.new(r, g, b), which expects three arguments that represent the red, green and blue components of the color respectively. Color3.new expects these values to be in the range 0 through 1; in other words, a percentage.

  • Color3.fromRGB(r, g, b), which is an alternative way of creating colors from their RGB values, except this function expects them in the range 0 through 255. This is most likely the one you want to use.

  • Color3.fromHSV(h, s, v) is a totally different way of creating a Color3. It expects three arguments which correspond to the hue, saturation and value of the color. The hue is the pure color (red, blue, green, yellow, purple, etc.), the saturation is the "colorness" (dull to fully colored) and the value is the brightness (black to white) of the color.

  • Finally, It is also possible to get the Color component of a BrickColor value:

local selectionBox = Instance.new("SelectionBox")

selectionBox.Color3 = BrickColor.new("Bright green").Color

Hope this helped. :)

The Color3.new function takes in 3 numbers.

  • Red component

  • Green component

  • Blue component

But i'm sure you already knew that. What you probably didn't know is that the monitor has a color gamut. The Color3.new function interprets the color gamut as numbers out of 255. Your arguments have to be numbers out of 255.

255/255 is the highest value, so anything higher(like 15, 124, or 7) will default to 1. This is why your SelectionBox kept getting turning white :)

selectionBox.Color3 = Color3.new(15/255, 124/255, 7/255)

There are 3 ways to make Color3 values.

Color3 takes 3 values, R,G,B, wich are Red, Green and Blue, but i assume you got that part.

The way's to make Color3's are simple:

BrickColor to Color3 conversion, Color3.new() and Color3.fromRGB()

How do we use those?

BrickColor to Color3

BrickColor to Color3 is done by putting in a brickColor and adding .Color after it:

BrickColor.new("ColorName").Color --> Will return the Color3 from the brickColor wich you can instantly use on anything.

(For all brick colors, look here )

Color3.fromRGB()

Color3.fromRGB() will allows you to insert values from 0 to 255 instead of deviding everything by 255. (If you didn't know, 255 is the max value for Color3.)

Color3.fromRGB(15, 124, 7) --> will make your thingy the color you want

Color3.new

Color3.new() will require you to insert values from 0 to 1. 0 will refer to 0, 1 will refer to 255

Color3.new(0, 1, 0) --> will make something lime green.

3 comments

0

You forgot Color3.fromHSV(). ;)

0

FromHSV transfers Color3.fromRGB to Color3.new(), it servse no purpose for creating color3's

0

It does allow you to create Color3s. Hue, saturation and value are just a completely different way to represent colors.

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