So, i made a betting gui, you select the amount, and you click the button. If you lose, you lose the amount of your betting money. If you win, your betting money will be doubled. The problem is: you always win. I've tested this, even restarting the game (clicking stop then test again).
Here's the code:
math.randomseed(tick())
script.Parent.MouseButton1Down:connect(function()
local betmoney = tonumber(script.Parent.Parent.TextBox.Text)
local playermoney = tonumber(game.Players.LocalPlayer.leaderstats.Money.Value)
if betmoney > playermoney then
print("lolno")
script.Parent.Text = ("Error!")
wait(1)
script.Parent.Text = ("Bet")
else
if betmoney > 0 then
script.Parent.Text = "Betting..."
local profittable = {"true", "false"}
local profit = profittable[math.random(2)]
print(profit)
if profit == "true" then
game.Players.LocalPlayer.leaderstats.Money.Value = playermoney + betmoney
script.Parent.Parent.Parent:Destroy()
else
game.Players.LocalPlayer.leaderstats.Money.Value = playermoney - betmoney
script.Parent.Parent.Parent:Destroy()
end
else
print("lolno")
script.Parent.Text = ("Error!")
wait(1)
script.Parent.Text = ("Bet")
end
end
end)
