I am trying to make an ATM, whenever I fire the server and put the variables in the server script, it just prints my values to my players name...

submit = script.Parent

text_box = submit.Parent.Placeholder

plr = game.Players.LocalPlayer

ls = plr:WaitForChild("leaderstats")

bank = ls.Bank

RS = game:GetService("ReplicatedStorage"):WaitForChild("Server")

withdraw = RS:WaitForChild("Withdraw")

submit.MouseButton1Click:Connect(function()
	local text = text_box.Text
	if tonumber(text) then
		local amount = Instance.new("IntValue",script.Parent)
		amount.Name = "Amount"
		amount.Value = text
		local number = amount.Value
		if bank.Value >= amount.Value then
			print("Enough money!")
			withdraw:FireServer(text)
		elseif bank.Value < amount.Value then
			print("Not enough money")
		else
			plr:Kick("Error Code 1, please screenshot your debug and send it to a developer.")
		end
	end
end)

4 comments

0

1). Nothing can be done without the server-sided code.

0

2). Instantiating an IntValue to round the amount is foolish, especially the fact that you don't remove it afterward; you will pile up a mountain of IntValues.

0

3). You're still vulnerable to an infinite money exploit. Sanity checks must be carried out on the server as well.

0

4). The whitespace between your variables ruins readability.