I am trying to make a crate system. I have Commons, Rares, Legends, and Godly's. Everything unboxes just fine but when I try to unbox the Godly Crate This Error Shows, " . Allbad argument #2 to 'random' (interval is empty)" Crates run through the same script, so I don't get why it does this. Help if you can! Here is the part of the codes that shows the error,
local Choose = math.random(1,100); local ChanceTable = {}; for Rarity,Chance in pairs(Chances) do for i = 1,Chance do table.insert(ChanceTable,Rarity); end end; SelectedRarity = ChanceTable[math.random(1,#ChanceTable)]; SelectedKnife = ItemTable[SelectedRarity][math.random(1,#ItemTable[SelectedRarity])]; -- Shows the error on this line ChanceTable = {};
there are two ways math.random #2 will be an error