I am trying to add a third value to the “chosenitem” table called “Rarity”, which will hold the value of the rarity variable.
I’ve tried using table.insert but it only returned the rarity by itself.
function itemFromRarity(rarity)
local availabeItems = packInformationModule.Rewards[rarity]
local chosenItem = availabeItems[math.random(1,#availabeItems)]
print(chosenItem)
return chosenItem
end
Okay, if I’m understanding it correctly, can’t you just add the rarity when you get the item? Or you can run a for loop when the module is required and give each item a “Rarity” value corresponding to the table they’re in.