Argument 1 missing or nil

what does Argument 1 missing or nil mean? Because i keep getting this error and sometimes it would work and sometimes it wouldn’t.

TradeRemotes.secondConfirmation.OnServerEvent:Connect(function(player, value, itemName, object, requesterName)
	local trader = game:GetService("Players"):FindFirstChild(requesterName) -- Error here
end)

requesterName is missing or nil

1 Like

Print your arguments. It’s likely one is missing on the client side.

Check these things:

  1. You are really firing that argument;

  2. the argument isn’t nil;

  3. in the client side you fire the same arguments you have in the server script except for the player one;

  4. the value you search in the players service exists, to do this add an if like this:

     if game:GetService("Players"):FindFirstChild(requesterName) then
         local trader = game:GetService("Players"):FindFirstChild(requesterName)
     end
    

This will create the variable only if it finds the argument in the players service

If nothing helps try to print the value and see what it really is

1 Like

Could you please tell us the value of requesterName or how you get the value?

so requesterName is this

local requesterName
Remotes.ConfirmTrade.OnClientEvent:Connect(function(name)
	requesterName = name
end)

it printed nil for both but im not sure why

Can you send the script of the client firing the event?

Also, is name a string? Remember that you need to fire the player argument too from the server

1 Like

He use a OnServerEvent which mean he doesn’t need to send the player argument

This is onClientEvent, so he should fire it

i figured out the problem It was nil but i just made a new variable. Thanks for your help everyone

Yes but he had the issue on OnServerEvent

Anyway he found the problem, everything’s fine

Yes but if he fires the requester name from the client which sends a value fired from the server he needs to fire the player argument on the server