I've been trying to make a money transfer system for my game, but everything I've tried always gets this error: "Argument 1 missing or nil." This is the script firing the remote event.
receiver = script.Parent.Receiver.Text
amount = script.Parent.Amount2Send.Text
amount2send = tonumber(amount)
sendButton = script.Parent.Send
plrName = game.Players.LocalPlayer.UserId
sendButton.MouseButton1Click:Connect(function()
game.ReplicatedStorage.BankTransfer:FireServer(amount2send, receiver, plrName)
end)
script.Parent.Close.MouseButton1Click:Connect(function()
script.Parent.Visible = false
end)
This is the serverscript.
game.ReplicatedStorage.BankTransfer.OnServerEvent:Connect(function(amount2send, receiver, plrName, plr)
local sender = plrName
local receiverID = game.Players:GetPlayerByUserId(receiver)
local amount = amount2send
if plr.Wallet.Value >= amount then
plr.Wallet.Value = plr.Wallet.Value - amount
receiverID.Wallet.Value = receiverID.Wallet.Value + amount
end
end)
