Hello, I have a StringValue that has a certain rarity that gets set by random. Say this time around the rarity is ‘Legendary’.
Now I have a TextLabel that is supposed to reveal what item you got as well as the rarity of this item (via Colors)
My problem is actually getting the game to choose an item for me. I have this 2D array that looks like this:
local Rarity = script.Parent.Parent.Rarity
local Items = {
Common = {
"Wood",
"Stick",
"Stone",
"Dirt",
"Ore",
},
Uncommon = {
"Sulfur",
"Copper",
"Coal",
"Glass",
},
Rare = {
"Rust",
"Bronze",
"Iron",
"Aluminum",
},
Epic = {
-- pls give ideas lmao
},
Legendary = {
"Gold",
"Diamond",
"Sapphire",
"Emerald",
"Ruby",
"Amber",
},
Mystic = {
-- pls give ideas lmao
}
}
Ok now the localscript needs to set the textlabel to those items, so I did:
for i, v in pairs(Items) do
if i == Rarity.Value then
local randomItem = math.random(1, #i:GetChildren())
script.Parent.Text = Items[i][randomItem]
end
end
But it did not work. Any help please?