Hello! I know some of you may be looking for an easy way to get every BrickColor there is.
Lucky for you, I have found a way to do that!
First of all, you may or may not know that each BrickColor has a different number assigned to it. This is very useful.
The reason it is useful is because we can get all of the BrickColors and add them into a table of colors using their number.
We need to see the highest BrickColor number in Roblox. To do this, we will go into the developer API
The link: BrickColor Codes
Luckily for us, the codes go in numerical order. We can scroll all the way to the bottom to see that “Hot pink” has the highest value, it being 1032.
We will do a quick for loop to loop through each number 1 - 1032. But before that, we need a table
local Colors = {}
for i = 1, 1032 do
end
Now, we will get the number of the BrickColor.
local Colors = {}
for i = 1, 1032 do
local BrickColorValue = BrickColor.new(i)
end
Now that we have the number, we can add it to the table. But wait! Some numbers from the range 1 to 1032 aren’t assigned to a BrickColor. Thus, it will return
BrickColor.new("Medium stone grey")
To work around that, we will check if they table already has the BrickColor “Medium stone grey.” To do this, we will use table.find()
local Colors = {}
for i = 1, 1032 do
local BrickColorValue = BrickColor.new(i)
if not table.find(Colors, BrickColorValue) then
end
end
By doing that, it asks “If I don’t find the BrickColor(”…") then…
Now, we will add the BrickColor to the table if it’s not already in it.
local Colors = {}
for i = 1, 1032 do
local BrickColorValue = BrickColor.new(i)
if not table.find(Colors, BrickColorValue) then
table.insert(Colors, BrickColorValue)
end
end
And just like that, you know have a table of every BrickColor!
If you were to print the table: