Little Issue with a atm script

I’m making a atm script and i have a little issue with the values

this is a comfirm buttom script

local buttom = script.Parent
local back = buttom.Parent
local plr = buttom.Parent.Parent.Parent.Parent
local leader = plr:WaitForChild("leaderstats")
local ValueInsert = back.InserirValor.TextBox
local operacao = back.Operacao
local remotevent = game.ReplicatedStorage.Operacoes
local ValorInserido = back.ValorInserido

script.Parent.MouseButton1Click:Connect(function()
	if operacao.Value == 1 then
		if tonumber(ValueInsert.Text) then
			remotevent:FireServer(plr, ValorInserido)
			print("Call")
		end
	end
end)

they are in a local script to see if the textbox item have number, they call a remote event with some values to make the operation to the server, for here no problems

now here is server script

local remotevent = game.ReplicatedStorage.Operacoes


remotevent.OnServerEvent:Connect(function(plr, ValorInserido)
	if plr.leaderstats.Carteira.Value >= ValorInserido.Value then
		plr.leaderstats.Carteira.Value -= ValorInserido.Value
		plr.leaderstats.Banco.Value += ValorInserido.Value
		print("Recived")
	end
end)

they are making this erro in output

image

but i dont understand, i put the right location if someone can tell where ir the error or some more easy way to make a atm script i will be glad (sorry for the bad english i’m praticing)

When you fire a RemoteEvent at the server, you do not have to include the Player parameter. This is automatically added. Remove your plr value in the above and it should then work.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.