Is this a necessary check?

someRemote.OnServerEvent:Connect(function(player)
    if not player then return end 
end)

I’ve been doing this in all of my remotes and it’s become a habit, but looking back at it I’m not sure if this is necessary. Is there ever a chance the player could be nil? The only case I can think of is that a client fires a remote, and then leaves before the request gets to the server.

No. Player will always exist when the remote is fired (since you have to have a client to fire the remote.)

On the topic of the player leaving before the request gets to the server, the only time this will happen is when your events are backlogged for some sort of reason (in which you have a larger problem.) The server script won’t recognize the player leaving faster than the remote can fire, as the time it takes for that information to travel is solely dependent on the latency. Additionally, players stay in the Players service for slightly longer in order to allow things such as PlayerRemoving events to do their job properly.

1 Like

There shouldn’t be a chance the player is nil but you can do this if you want. I wouldn’t do this.