Greetings, I need help with connecting this textbox, which can be seen as, ‘Insert amount’ in the photo.
I would like this to function so you write the amount of leaderstat coins, that you would like to bet, however if the player doesnt have that much coins (which is known as scamollars in this game) then it would return an error inside the Status textbox. If the player does have that much, for example: if they write 10 and then press the gamble button - they will have a 50% chance of winning, if they win…the betting amount will be doubled, so in this case it would be 20 scamollars they would win. If they player lost, they would lose the betting amount.
And no, this is is not against ToS, as this is gambling in-game coins as fun.
script.Parent.MouseButton1Click:Connect(function()
local player = game.Players.LocalPlayer
local coins = game.Players.LocalPlayer.leaderstats.Scamollars
local randomnumber = math.random(1, 2)
local eventwin = game.ReplicatedStorage.Gamble.GambleWin
local eventlost = game.ReplicatedStorage.Gamble.GambleLost
local EnterAmount = script.Parent.Parent.TextBox -- the place the textbox is located, which you will enter amount.
if coins.Value <= 0 then
script.Parent.Parent.Parent.Menu.Status.TextColor3 = Color3.new(1, 0, 0)
script.Parent.Parent.Parent.Menu.Status.Text = "❌ Not enough coins!"
script.Parent.Loss:Play()
wait(5)
script.Parent.Parent.Parent.Menu.Status.Text = ""
return end
print(randomnumber)
if randomnumber == 1 then
print("You've won!")
script.Parent.Parent.Parent.Menu.Status.TextColor3 = Color3.new(0.333333, 1, 0)
script.Parent.Parent.Parent.Menu.Status.Text = "🎉 You've won!"
script.Parent.Win:Play()
eventwin:FireServer(player)
wait(5)
script.Parent.Parent.Parent.Menu.Status.Text = ""
else
print("You've lost!")
script.Parent.Parent.Parent.Menu.Status.TextColor3 = Color3.new(1, 0, 0)
script.Parent.Parent.Parent.Menu.Status.Text = "❌ You've lost!"
script.Parent.Loss:Play()
eventlost:FireServer(player)
wait(5)
script.Parent.Parent.Parent.Menu.Status.Text = ""
end
end)
I’ve tried to contact others with helping me, however they were unable to do so - therefore I’m reaching out to this community with helping me.