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

Remote Events: How to get the name of the player the event was fired by?

Asked by 6 years ago

I don't know how to get the name of the client which the Server event was fired by. Anyone know how?

1 answer

Log in to vote
0
Answered by
UgOsMiLy 1074 Moderation Voter
6 years ago

The first argument on OnServerEvent is the player that fired it. Just use player.Name

LocalScript

RemoteEvent:FireServer("hello")

Script

RemoteEvent.OnServerEvent:Connect(function(player,word)
    print(player.Name)
    print(word) --> hello
end)

Just remember that the player parameter goes first, so although "hello" is the first argument in the LocalScript, it is the 2nd parameter in the script.

Ad

Answer this question