So I am trying to make a bank ATM. I made the gui so it is like I have a textbox then 2 buttons. 1 Button says 'Deposit' and the other one says 'Withdraw'. So when I enter a amount and then click on any of those buttons this error shows up:
07:45:56.117 - Players.iiLevelMaker.PlayerGui.ATMGui.Container.withdraw.LocalScript:9: attempt to compare string with number
This is the script for deposit:
local player = game:GetService('Players').LocalPlayer
local gui = player:WaitForChild('PlayerGui'):WaitForChild('ATMGui')
local button = gui:WaitForChild('Container').deposit
local amountbox = gui:WaitForChild('Container').TextBox
local cash = player.leaderstats.Cash
local bank = player.leaderstats.Bank
function MouseClick()
if cash.Value >= amountbox.Text then
bank.Value = bank.Value +amountbox.Text
cash.Value = cash.Value -amountbox.Text
end
end
button.MouseButton1Click:connect(MouseClick)
This is the script for withdraw:
local player = game:GetService('Players').LocalPlayer
local gui = player:WaitForChild('PlayerGui'):WaitForChild('ATMGui')
local button = gui:WaitForChild('Container').withdraw
local amountbox = gui:WaitForChild('Container').TextBox
local cash = player.leaderstats.Cash
local bank = player.leaderstats.Bank
function MouseClick()
if bank.Value >= amountbox.Text then
cash.Value = cash.Value +amountbox.Text
bank.Value = bank.Value -amountbox.Text
end
end
button.MouseButton1Click:connect(MouseClick)

4 comments
I will try it :)
Did it work?
Damnit goul! xD I saw this in chat and was gonn' answer haha.
It worked.