When Player Leave
Fires when a player exits the game or leaves the current match.
Introduction
When Player Leave is an event in the World group of World Events. It fires when a player exits the game or leaves the current match, and the event hands the leaving player to your script as a parameter. Keep one thing in mind: this event only runs while other players are still in the room. If the last player leaves, the script will not execute at all. Because of that, do not put save-related logic under this event, since the save would be skipped exactly when the room empties. Leaving is the back door of your world: this event pairs with When Player Joins , and it is the only safe place to clean up scoreboards, teams, and held items. If the exit was a defeat instead, the chain usually passed through When Character is Killed , and re-entry is handled by When Character Respawns . When Player Leave event in the Script Editor Image The When Player Leave event in the Script Editor. caption
Parameters
Player the player who just left the game Parameter Description
How to Access
How to Access - Event When Player Leave
How to Use
Open Setting, World from the top toolbar; the panel floats on the right side of the screen. In the World Events category, press the + button next to When Player Leave to add the event. Add the actions that should run when the event fires below it. Press Play and leave the world while another player stays in it, then check that the actions run.
Example
Example script for removing a player area or plot when the player leaves When Player Leave - Remove Area Plot Example: Remove a player area or plot when that player leaves. caption
Common Uses
Show a message announcing that a player has left Free up the seat, team slot, or vehicle that player was using Save that player’s score before they are removed from the session
Tip
Need to save a player’s progress on exit? Do it earlier at a checkpoint or through When Prop is Added style milestones instead, because this event is not guaranteed to run for the last player in the room.