Client sending Player no matter what

for some reason everytime i fire a remote event and transfer a variable over to the server (EVEN IF ITS NOT PLAYER RELATED) it will always send a player variable instead of what i intended it to send over

Server
RS.OnServerEvent:Connect(function(Target)
	print(Target)
end)
Client (ignore the test variable)
   TargetToHit = "pdspfpasdf"
script.RemoteEvent:FireServer(TargetToHit)
Aiming = false

this is really annoying, i dont know why it happens, i’ve tried everything and it still sends the player instead of the variable i wanted it to send

The Player that activated a RemoteEvent is always implicitly sent through as the first argument. The only change you’d need to make on the server is create a new parameter to reference any additional values being sent through:

RS.OnServerEvent:Connect(function(player, Target)
	print(Target)
end)
1 Like

it still keeps sending the player, no matter what i do, thats literally what i was doing originally

Theres no way to prevent this, its just part of the roblox API

The ability to change it would pose a huge security risk and be overcomplication of the API
You should just get in the habit of adding player as the first argument every time you use OnServerEvent or OnServerInvoke

thing is, its ignoring any additional values that i send and replacing it with the player

Just do what @StrongBigeMan9 said
Your arguments will be displaced by 1, so for example if you did:

Client

event:FireServer("Hello world",5)

You would have to do

Server

event.OnServerEvent:Connect(function(player,text,num)
    print(player) --player
    print(text) --hello world
    print(num) --5
end)
2 Likes

i could have sworn that you had to put the player on the fireserver event, thanks though

1 Like

the problem is, i cannot reference the first argument except as ‘self’, it silently shadows the real ‘self’, and displaces all other arguments’ indices by 1