Here is my script:
local lPC = 1 -- what if I changed these to decimals. That is where I want the table to become bigger so that a value will be put into the table, but be the percent chance that I want.
local rPC = 9
local uPC = 25
local oPC = 65 -- just the chances that it will appear.
-- Arrays --
local boxTable = {}
-- Functions --
local function fillBoxTable()
local totalLengthOfTable = lPC + rPC + uPC + oPC
local lAmount = math.floor((lPC / 100) * totalLengthOfTable)
local rAmount = math.floor((rPC / 100) * totalLengthOfTable)
local uAmount = math.floor((uPC / 100) * totalLengthOfTable)
local oAmount = math.floor((oPC / 100) * totalLengthOfTable)
for i = 1, totalLengthOfTable do
if i <= lAmount then
boxTable[i] = "Legendary Box"
elseif i <= rAmount then
boxTable[i] = "Rare Box"
elseif i <= uAmount then
boxTable[i] = "Uncommon Box"
elseif i <= oAmount then
boxTable[i] = "Ordinary Box"
end
end
end
I think the problem is that this will not make a larger table based on percentage sizes. I am really confused and hope someone can help me out. Thanks!

2 comments
Thanks for your help!
While not exactly what I was looking for it still presented some solutions.