If anyone can help i'd be very grateful. :)
local raritys = {
Common = 5,
Uncommon = 3,
Rare = 1,
Legendary = 0.2
}
local crateInUse = true
local function openCrate(chance)
if crateInUse == true then
local items = {}
local result
local frametimes = math.random(20,30)
for _,Item in pairs(game.ReplicatedStorage.Items:GetChildren()) do
local rarNumber = raritys(Item.Rarity.Value)
local times = math.max(rarNumber/chance)
end
math.randomseed(tick())
for num = 1,frametimes+5 do
local item = items[math.random(#items)]
local newicon = script.Parent.Unboxing.Inner.Icon:Clone()
newicon.Visible = true
newicon.Parent = script.Parent.Unboxing.Inner
newicon.Image = item.ImageID.Value
newicon.Position = UDim2.new(0,100*(num-1),0,0)
if num == frametimes then
result = item
crateInUse = false
end
end
end
end
script.Parent.TextButton.MouseButton1Click:Connect(openCrate(2))

3 comments
use [] instead of ()
And where do i do that?
local rarNumber = raritys[Item.Rarity.Value]