Why is my RemoteEvent printing the wrong variable?

For some odd reason my remote event is printing the wrong argument, I tried rearranging them and changing the names but it’s still printing the wrong thing.

image
Prints:
image


Prints:
image

2 Likes

The first parameter using OnServerEvent will always be the Player without you passing the Player parameter so simply on the client do this:

AddStand:FireServer(UserId, StandName)
1 Like

The First Parameter in OnServerEvent will always be the Player, the rest will contain your Data, so you will need to add a Foruth Parameter, and print from the Second - Fourth

YourData: player, UserId, StandName
OnServerEvent: Player, player, UserId, StandName -- it shifts
-- The First will always be the Player, so you will need to grab the others

But because we already have the Player, you dont need the first two parameters, so in total, you will have two parameters for this event.

1 Like

Hi there!
When you are using RemoteEvents and RemoteFunctions, the first argument recieve on the server is actually the player! So the arguments you choose to pass then come afterwards.
This is done for security reasons, as exploiters can choose to pass whatever arguments they want, but the first received argument will always be which players fired the remote.
This also means you don’t need to pass the player on the client, so all you need to do is remove the player variable from the remote call on the client.

Hope this helps!

2 Likes

When you use :FireServer() you don’t need to type in the player

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