I am trying to assign a color to items with certain rarities.
Currently the only thing I tried was this, because I couldn’t think of anything else.
Piece of script in question:
local rarities = {
["Common"] = 179, 179, 133;
["Rare"] = 249, 183, 60;
["Epic"] = 193, 61, 198;
["Legendary"] = 65, 94, 198;
["Unobtainable"] = 208, 208, 208;
["Event"] = 198, 41, 41;
}
local newSkinBox = shopFrame.SkinTemplate:Clone()
local rarityValue = skin.Rarity.Value -- This is the value that indicates what rarity a certain skin is.
local skinRarity = newSkinBox.Details.Rarity -- This is a frame that I am trying to assign the color of rarity to.
skinRarity.BackgroundColor3 = Color3.new(rarities[rarityValue])
If you didn’t know, this is essentially what your table looked like to roblox:
A comma in tables is what luau uses to separate values. Tables are allowed to have any key/index, which is why after the first comma you used started to insert to numbered indexes instead. A semicolon is a conveniency with luau, since multiple statements can already be declared on the same line, so the semicolons in your code were doing nothing