How would I insert Color3 Values in a table?

Hello, so I want to use Color3 values in a table to store it and then use it on Uis for my level generating kind of game.

I tried storing Color3 values into a table but only gived me numbers between 1 and 0 instead of giving me the Color3 value I stored.

All help is appreciated :smiley:

thats because is different from Color3.fromRGB() ranges from 0,0,0 to 1,1,1 where 0,0,0 is black and 1,1,1 is white
Color3.fromRGB() ranges from 0,0,0 to 255,255,255 where 0,0,0 is black and 255,255,255 is white

tbl["thiscolor"] = Color3Value.R / 255,  Color3Value.G / 255,  Color3Value.B / 255)

I dont think brick colors can be used in uis can they?

1 Like

Oh, just noticed that. Sorry, ignore my comment.

1 Like

Can’t you just store them like this:

local ColorTable = {,,,,


local ColorTable = {
    Color1 =,
    Color2 =,
    Color3 =,
    Color4 =,
1 Like

probobly but I insert them. the table dosent have values right away because its a level generating kind of game like toh(tower of hell) so each round needs new colours.

How would that work if I insert them not manually but with the table.insert function.

First of all, You seem to be missing the fact that BrickColor.Random() exsists.
This function already has random colors in it and will choose a different color for each floor.

Secondly, If you really wanted to manually insert the colors you could just insert them as arrays.
An Example:

local ColorTable = {
    Color1 = {R = 255, G = 70, B = 10},
    Color2 = {R = 100, G = 50, B = 255},

local function GetColor3()
    local RandomColor = ColorTable[math.random(1, #ColorTable)]
    return Color3.fromRGB(RandomColor.R, RandomColor.G, RandomColor.B)

I want to insert them with the table.insert function from a script, not manually.

You can just do

table.insert(ColorTable, {R = 100, G = 100, B = 100}
1 Like

Like Cosmental has said, you will have to serialize the Color3 value. You can do this two ways. Turning it into a string using tostring and then using string.sub to get the numbers or by using what Cosmental said which is the best way to do this.