local Raritytimes = {
["Common"] = 80,
["Uncommon"] = 15,
["Rare"] = 5,
}
local CrateInude = false
local function opencrate(Chance)
if CrateInude == false then
CrateInude = true
local items = {}
local frametimes = math.random(30,32)
local rewardbutton
for i,v in pairs(game.ReplicatedStorage.Items:GetChildren()) do
local rarnumber = Raritytimes[v.Rarity.Value] or 1
local mathmatical = math.max(Raritytimes+Chance)
for i = 1,mathmatical do
table.insert(items,v)
end
end
math.randomseed(tick())
for i = 1,frametimes+5 do
local item = items[math.random(#items)]
local newsapme = script.Parent.Unboxing.SampleItem:Clone()
newsapme.Visible =true
newsapme.Parent = script.Parent.Unboxing.inner
newsapme.Icon.Image = item.Image.Value
newsapme.ItemName.Text = item.Name
newsapme.Position = UDim2.new(0,100*(i-1),0,0)
if i == frametimes then
rewardbutton = newsapme
end
end
for num = 1,(rewardbutton.Position.X.Offset - (255+math.random(-40,40)))/15 do
for i,v in pairs(script.Parent.Unboxing.inner:GetChildren()) do
v.Position = UDim2.new(0,v.Position.Offset-15,0,0)
if v.Position.X.Offset <= -150 then
v:Destroy()
end
end
wait(0.01 * 1.05 ^ (num-105)/2)
script.Tick:Play()
end
end
end
opencrate(0)
The error is: 12:05:27.690 - Players.shootthegame.PlayerGui.BasicCrate.LocalScript:17: attempt to perform arithmetic on upvalue 'Raritytimes' (a table value)
(the error is in line line 17)
Can anyone help me fix the problem?
