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

How do I get the name of the color from the Color3 Value?

Title is self explanatory. Been trying to figure how to convert the Color3 Value to it's BrickName. I know there is a way of defining each code f.e:

local Color3Value = script:WaitForChild("ColorValue").Value
local BrickName = ""
if Color3Value.Value == Color3.new(0, 0, 0) then
BrickName = "Black"
elseif Color3Value.Value == Color3.new(255, 0, 0) then
BrickName = "Red"
---etc.
end

but I'm sure there is another, more efficient way.

4 comments

1

I think you should use BrickColor.New(Color)

0

I don't think you're able to convert them sadly, only the other way around...All I can think of is a huge elseif chain, but that's not very efficient.

0

You could set a part's colour and then use it's BrickColor as BrickName? I'm not sure what exactly what you mean

0

BrickColor.new(brick color constructor here).Name, sadly doesn't work for color3 values

1 answer

BrickColours can be constructed with Colour3's. It'll return the closest BrickColour to that Color3. http://wiki.roblox.com/index.php?title=BrickColor#BrickColor.new

You can convert it to a BrickColour, then get its name.

local Bc = BrickColor.new(Color3.fromRGB(255, 0, 0)).Name
print(Bc) -- Really red

local nextBC = BrickColor.new(Color3.fromRGB()).Name) -- Color3.fromRGB() defaults to Color3.fronRGB(0, 0, 0) if no arguments are specified.

print(nextBC) -- Really black

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