Player That fired the event?!

so `

a localScript for example: Event:FireServer()

then a script: Event.OnServerEvent(Player)

The first variable is always the player who fired the event
but aren’t event fired by scripts?
a player fires an event?

1 Like

Each player in a server will have his/her own client code. So while using RemoteEvents, the script fires the server the parameters, along with the name, since it won’t be possible to identify the player who had fired the event.

This isn’t something to get agitated over tho, its just how the backend of roblox works.

You can only ever call

RemoteEvent:FireServer()

from a local script. And all local scripts have their attached player (you can access it with game.Players.LocalPlayer).Meaning that it is the script that fires the remote, but it passes it’s player along

so like it’s the player that made everythig required in the local script for example a local script that fires an event when a player steps on a part, that player who steps on the part will be the player that can be used in server script?

yes, if you use an event and fire it, the first parameters is the player instance. so you would know who fired it. But if your firing from server to client, the first parameter is not the player. since you can just game.Players.LocalPlayer

2 Likes