New ExitReason parameter for PlayerRemoving

Hey Creators,

We’ve added a new optional parameter to the PlayerRemoving event called exitReason, which tells you why a player left your experience.

This gives you more visibility into why a session ended, such as whether a player left voluntarily, was kicked by the experience, or was removed by the platform.

Details

This new parameter uses the PlayerExitReason enum. This parameter is only exposed on the server. On the client it will always return PlayerExitReason.Unknown. Initially, the enum includes three values:

Value Description
Unknown The reason for leaving isn’t known. (Always returned on the client.)
PlatformKick The player was removed by the platform.
CreatorKick The player was removed by the creator using Kick() or a similar API.

Here’s a simple example of how you can use it in your experience:

Players.PlayerRemoving:Connect(function(player, exitReason)
	print(`{player.Name} left due to {exitReason.Name}`)
end)

Documentation

223 Likes

This topic was automatically opened after 10 minutes.

Great update! Will there be a PlayerExitReason.Disconnected added in the future? It would be really helpful for games where players lose connection and end up losing their win streak, for example. I understand some might disconnect intentionally to exploit that, but in most cases, it would be a positive change.

184 Likes

This doesn’t seem overly useful. Unknown doesn’t tell us anything, and we already know if they are kicked/banned by our own systems.

I would like to know if they leave from a crash, internet disconnection, and from them rejoining the game.

129 Likes

This is something I wanted a decade ago for a PVP game I never ended up developing that far. Being able to understand intent for leaving (ex: leave before losing stats vs just lost connection at a bad time) would have been really useful.

The docs don’t seem to cover this, what enum would be passed for a player manually disconnect (leaving or closing client), and what would be passed for a connection timeout? The first one is not clear to me (Unknown?), and the second one I being Unknown or PlatformKick. We can differentiate these cases, right?

33 Likes

This is an excellent change for detecting player leaves. I run a system that tracks in-game activity and this’ll help in case someone gets disconnected by Roblox.

Will we be able to provide our own values for exitReason so we can let our scripts know why someone is being kicked? That’d make this system infinitely better for various reasons.

9 Likes

great update, a few questions:

  • PlatformKick sounds pretty vague and seems like it’s a just ROBLOX-system kicked thing, could we have more documented examples on what constitutes as a PlatformKick?
  • Unknown right now serves as a catch-all, which isn’t really useful to know whether a client has disconnected voluntarily, due to a game crash, or anything along that line. what are the plans to make this more verbose in the future? or some sort of error code returned?
13 Likes

all i’m gonna say for this is: :+1:
altho the unknown reason does seem kinda useless

7 Likes

This is a great step forward in terms of visibility for developers and for Roblox. I hope the team working on Recommendation signals makes a good use of it.

  1. Please note that PlayerRemoving fires when removing from a place, not from an experience.
  2. Other common reasons could be included, such as:
  • Successfully teleported out to another place within the same game
  • Successfully teleported out to another game
  • Leaving by shutting down the Roblox client
  • Timed out
  • Client crashed
19 Likes

Will there be a CreatorBanned variant of this? Would be neat addition to determine if the player was banned with BanAsync.

11 Likes

We need a enum of them leaving and joining a different game.

Sometimes I am in a game, and someone invites me to a different game, I accept the invite and my client leaves the current game and goes to the invited game

5 Likes

This would be nice as with banasync it stops the usage of ban lands as it instant kicks users.

1 Like

WOHOO, a better step in the right direction!

perhaps you guys can add more reasons in the future?

such as:

  • being teleported anywhere within the experience
  • teleporting to a different game
  • timed out

etc etc

7 Likes

Interesting. I imagine the PlatformKick as a thermometer for knowing whether players are being banned for exploiting or bad behavior
I wish it was a Teleport Enum as well or possibly a Crash Enum

2 Likes

What was the motivation for adding this API? Seems meant for a very niche use given the narrow range of reasons supported at release.

10 Likes

Is CreatorKick also from migrating servers? This would help us with our combat logging system where players lose their items if they leave while in combat. If we can determine it comes from us migrating our servers we can prevent angry players. We have been using a weird workaround for this but it’s never been 100% reliable.

1 Like

Great debugging feature, thanks for adding this! I already know this will be used a lot

1 Like

I want to test it out because Its so awesome! Thanks :heart:

1 Like

This is very useful, thank you. :+1:

edit: whats the likely-hood of catching someone ‘tabbing’ in battleground games, then firing an event to chat; this would be so funny.

edit 2;

i just read this

1 Like

how would you make a game with this new addition

4 Likes