Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Client or Serverside event?

This is a quick question, it may be stupid but I'm going fast right now typing a Script so my head is weird, I want to run a function tied to the Players.PlayerRemoving event, can that be done Serverside?

Eg.

local Players = game:GetService("Players")
Players.PlayerRemoving:Connect(function(Player)
	--// function
end)

?

1 answer

✓ Accepted answer

You can use this event on both sides, it will fire when any player leaves the game.

Using it on a local script DON'T will make it fire only when the local player leaves!

Useful links:

API: Players.PlayerRemoving

Hope this helps

Good luck with your games

2 comments

0

Thanks!

1

I don't know where the assumption of the event only firing for the client's Player object came from. The event behaves the exact same on both ends, the server and the client. It's totally fine to use it on both.

This discussion is preserved as it was. New answers, comments, and votes are closed.