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

How do you convert BrickColor to Color3?

Asked by
Asigkem 32
8 years ago

Why does the following code not actually return a proper Color3 value that is the same as the brick color?:

local brickcolor = BrickColor.new("Really red")
local color = brickcolor.Color

1
Use BrickColorValueHere.Color to convert to Color3 TheDeadlyPanther 2460 — 8y

1 answer

Log in to vote
3
Answered by 8 years ago
Edited 8 years ago

BrickColors aren't the exact same as Color3 values. Color3 values range from 0 to 1 in 255 different shades in each R, G, B argument. However, BrickColors have a preset table of what they can be. In fact, you can see what this table looks like and all the BrickColors it stores, here.

Although, this is only a problem when converting a Color3 value, to a BrickColor. Since Color3 holds way more different color combinations than BrickColor, and BrickColor only holds a table of named colors, BrickColor will only choose the closest number it can find to your Color3 value in the table it has. This isn't usually a problem, but if you're looking for brick color tweening or something, it won't look smooth.

Summary

BrickColor to Color3 conversions will always be accurate, but Color3 to BrickColor conversions may seem a bit off sometimes. But in the code you provided, it does return the Color3 version of BrickColor "Really red" accurately.

0
You didn't actually tell him how, though... TheDeadlyPanther 2460 — 8y
2
Because he already did, there is nothing wrong with his code. ScriptGuider 5640 — 8y
1
The why he asked the question TheRealPotatoChips 793 — 4y
0
The link is broken nc2r 117 — 4y
Ad

Answer this question