So lets suppose i have a local script on player local scripts, and it Fires a remote event script, how can the server side script determine what player invoked it?
✓ ANSWER ACCEPTED
how to find what client Invoked server?
2 answers
✓ Accepted answer
LocalScript :
local RemoteEvent = --Location of the same RemoteEvent
local Data1 = 123
local Data2 = abc
local Data3 = true
RemoteEvent:FireServer(Data1, Data2, Data3)
Server Script :
local RemoteEvent = --Location of the RemoteEvent
local function OnServerEvent (Player, Data1, Data2, Data3)
--etc
print(Player.Name) --> CjayPlyz
print(Data1) --> 123
print(Data2) --> abc
print(Data3) --> true
end
If you don't put Player in the () then Data1 would be the variable for the Player.
1 comment
0
This had me to understand a lot more about remote, thanks
The player that called the server is actually passed as an argument to the server remote event handler; for example
-- server script
remote.OnServerEvent:Connect(function(player)
--handler code goes here
print(player.Name)
--etc
end
1 comment
0
i did not understand that well but thank you anyways :)!
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
there is a built in parameter in OnServerEvent