Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

RemoteEvent is getting error 'Argument 1 missing or nil', how do I fix it?

Asked by 6 years ago

So here is the code accessing the local script~

player.PlayerGui.ChangeMoneyGui.RemoteClient:FireClient()

and here is the code receiving the event.

local player = game.Players.LocalPlayer
script.RemoteClient.OnClientEvent:connect(function()
    player.PlayerGui.Money.Money.Text = "Money: " .. player.leaderstats.Money.Value
end)

Anytime I try to call the event I get the error "Argument 1 missing or nil". All the code seems fine so what's the issue. The first script is a script inside workspace. The second is a local script within the players GUI.

0
You are calling FireClient but don't actually specify which client to fire thus it errors, you either need to put the player it needs to fire or you need to put FireAllClients Vulkarin 581 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

It's because your script that is located on the server is confused on which client to send its request to.

Try this: player.PlayerGui.ChangeMoneyGui.RemoteClient:FireClient(playerName)

Ad

Answer this question