Like when I get to 5% it gives me my opening which then shows me legendary crates all the time I tried it like 6 times and got legendary crate I'm thinking it's because the math.random to the #of clones I think because the number of clones is 6 and I have else if c == 6 then legendary not sure please Help
crates = game.ServerStorage.Crates
commonclone = crates.Common:Clone()
uncommonclone = crates.Uncommon:Clone()
Rareclone = crates.Rare:Clone()
Ultrarareclone = crates.Ultrarare:Clone()
Epicclone = crates.Epic:Clone()
Legendaryclone = crates.Legendary:Clone()
clones = {commonclone,uncommonclone,Rareclone,Ultrarareclone,Epicclone,Legendaryclone}
c = clones[math.random(#clones)]
plr = game.Players.LocalPlayer
script.Parent.MouseButton1Click:connect(function()
local check1 = plr:WaitForChild("leaderstats")
if check1 then
local Percent = check1:WaitForChild("Percent")
if Percent then
Percent.Value = Percent.Value + 1
local Amount = plr.PlayerGui.CaseClicker.CaseClicker2.Search
Amount.Text = "Search For Crates : "..tostring(Percent.Value)..tostring("%")
if Percent.Value == 5 then
Percent.Value = 0
plr.PlayerGui.Chooser.Slots.Visible = true
if c == 1 then
commonclone.Parent = plr.PlayerGui.Chooser.Slots.Slot1
else if c == 2 then
uncommonclone.Parent = plr.PlayerGui.Chooser.Slots.Slot1
else if c == 3 then
Rareclone.Parent = plr.PlayerGui.Chooser.Slots.Slot1
else if c ==4 then
Ultrarareclone.Parent = plr.PlayerGui.Chooser.Slots.Slot1
else if c == 5 then
Epicclone.Parent = plr.PlayerGui.Chooser.Slots.Slot1
else if c == 6 then
Legendaryclone.Parent = plr.PlayerGui.Chooser.Slots.Slot1
end
end
end
end
end
end
c.Parent = plr.PlayerGui.Chooser.Slots.Slot1
end
end
end
wait(1)
end)

1 comment
Well, it's telling you that it can't find what the length of "choice" is on line 9 (#choice). You never told it what "choice" is before then, so your script has no idea what it is and can't get the length of nothing.