Need help in connecting textbox to button via leaderstat coins

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.

	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 =, 0, 0)
		script.Parent.Parent.Parent.Menu.Status.Text = "❌ Not enough coins!"
		script.Parent.Parent.Parent.Menu.Status.Text = ""

		return end


	if randomnumber == 1 then
		print("You've won!")
		script.Parent.Parent.Parent.Menu.Status.TextColor3 =, 1, 0)
		script.Parent.Parent.Parent.Menu.Status.Text = "🎉 You've won!"
		script.Parent.Parent.Parent.Menu.Status.Text = ""

		print("You've lost!")
		script.Parent.Parent.Parent.Menu.Status.TextColor3 =, 0, 0)
		script.Parent.Parent.Parent.Menu.Status.Text = "❌ You've lost!"
		script.Parent.Parent.Parent.Menu.Status.Text = ""


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.

I can help you just dm me kieranl29#3675 due to here it is very hard to see what part of the ui is what and things to help.

1 Like

Got it, I’ve sent you a request - I’m known as Adaks#0001.

Solved my issue, a pro scripter. :100:

1 Like