Hello, this is my first time here. I was wondering if there's a cleaner and better way to write a piece of code that allows the user to have chances to get an item chose, 80% for not rare items, 10% for rare, etc...
I had a friend suggest to do a table and randomly choose one of the things in it but is there anyway to make chances for each thing to get chosen?
if num > 200 then
game.Players.LocalPlayer.leaderstats.Crystals.Value = game.Players.LocalPlayer.leaderstats.Crystals.Value + 1
game.Players.LocalPlayer.leaderstats.Geodes.Value = game.Players.LocalPlayer.leaderstats.Geodes.Value - 1
script.Parent.Parent.TextLabel.TextStrokeColor3 = Color3.new(30,0,30)
script.Parent.Visible = false
script.Parent.Parent.No.Visible = false
game.Players.LocalPlayer.PlayerGui.promptGui.Frame.TextLabel.Text = "You received 1 Crystal!!! Better than none, right?"
wait(3)
script.Parent.Parent.Parent.Parent.Geodes.Frame.ready.Value = "True"
script.Parent.Parent.Parent:Destroy()
elseif num > 50 and num <201 then
game.Players.LocalPlayer.leaderstats.Crystals.Value = game.Players.LocalPlayer.leaderstats.Crystals.Value + 2
game.Players.LocalPlayer.leaderstats.Geodes.Value = game.Players.LocalPlayer.leaderstats.Geodes.Value - 1
script.Parent.Parent.TextLabel.TextStrokeColor3 = Color3.new(90,90,0)
script.Parent.Visible = false
script.Parent.Parent.No.Visible = false
game.Players.LocalPlayer.PlayerGui.promptGui.Frame.TextLabel.Text = "You received 2 Crystals!!! That's pretty rare!!"
wait(3)
script.Parent.Visible = false
script.Parent.Parent.No.Visible = false
script.Parent.Parent.Parent.Parent.Geodes.Frame.ready.Value = "True"
script.Parent.Parent.Parent:Destroy()
elseif num > 0 and num <51 then
game.Players.LocalPlayer.leaderstats.Crystals.Value = game.Players.LocalPlayer.leaderstats.Crystals.Value + 5
game.Players.LocalPlayer.leaderstats.Geodes.Value = game.Players.LocalPlayer.leaderstats.Geodes.Value - 1
script.Parent.Parent.TextLabel.TextStrokeColor3 = Color3.new(255,0,90)
script.Parent.Visible = false
script.Parent.Parent.No.Visible = false
game.Players.LocalPlayer.PlayerGui.promptGui.Frame.TextLabel.Text = "You received 5 Crystals!!! What a rare find!!"
wait(3)
