I heard that a lot of if statements can be inefficient, so i’m just trying to look for a way to use less of them. I’m pretty sure you can use Tables, but i don’t exactly understand how that works yet.
local bet1 = math.random(100,200)
local bet2 = math.random(200,300)
local bet3 = math.random(300,400)
local bet4 = math.random(400,500)
local bet5 = math.random(100,1000)
if betDPoints > 100 then
local Event
Event = clickBet.MouseClick:Connect(function(playerthatBet)
Event:Disconnect()
print(betDevice.Name.."has got Stocks")
local randomChoice = math.random(1, 5)
print(randomChoice)
--- very if
if randomChoice == 1 then
playerPoints.Value = bet1
elseif randomChoice == 2 then
playerPoints.Value = bet2
elseif randomChoice == 3 then
playerPoints.Value = bet3
elseif randomChoice == 4 then
playerPoints.Value = bet4
elseif randomChoice == 5 then
playerPoints.Value = bet5