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

what's the color of green selectionbox using script?

Asked by
npott13 23
7 years ago

Please encode Lua code in the Lua block code tag (look for the Lua icon in the editor).

(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

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. AstrealDev 728 — 7y

3 answers

Log in to vote
1
Answered by
Link150 1355 Badge of Merit Moderation Voter
7 years ago
Edited 7 years ago

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

Ad
Log in to vote
0
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
7 years ago
Edited 7 years ago

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)
Log in to vote
0
Answered by
RubenKan 3615 Moderation Voter Administrator Community Moderator
7 years ago
Edited 7 years ago

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.

0
You forgot Color3.fromHSV(). ;) Link150 1355 — 7y
0
FromHSV transfers Color3.fromRGB to Color3.new(), it servse no purpose for creating color3's RubenKan 3615 — 7y
0
It does allow you to create Color3s. Hue, saturation and value are just a completely different way to represent colors. Link150 1355 — 7y

Answer this question