PlayerRemoving containing the reason WHY a player left

As the title implies, I think that the PlayerRemoving event should have an Enum for why the player left. This way developers with competitive games can punish people for ragequitting with no consequence without penalizing them for something that isn’t their fault. I would’ve put this under Feature Requests, but the website didn’t let me.

local Players = game:GetService("Players")

local function onPlayerRemoving(player, reason)
	print("A player has left: " .. player.Name)
        if reason == Enum.LeaveReason.Disconnected then
            warn(player.Name .. " disconnected.")
        elseif reason == Enum.LeaveReason.UserLeft then
            print(player.Name .. " left voluntarily.")
    end
end

Players.PlayerRemoving:Connect(onPlayerRemoving)
1 Like

This would be hard to implement.
On mobile you can leave the game by closing the app via the task switcher.
On PC, Alt + F4/CMD + Q does the same thing.
ROBLOX can’t possibly detect the above ^^
Leaving the game on ROBLOX doesn’t just mean pressing “Leave Game”

I always use alt+f4 to leave a game and I don’t remember the last time I’ve used the leave button, so it would be hard to distinct. A feature like this also just feels odd to have.

Before the player leaves you could detect if they pressed alt, escape, etc. This would show if they willingly left. On mobile I don’t think somebody is going to be using a task manager to close their app. Instead on mobile you can detect if the escape menu was open. (well you could also check for this on computer too)

1 Like

A lot of people on iPad, including me just swipe up from the bottom which in most cases will disconnect you from the game (or because iPads have low RAM) clear it from memory

Also I don’t think there is even a way to detect what the last key press from a player was efficiently before they left, you’d have to fire an event every single key press…

1 Like

That is a good point, that would be a method hard to detect. On computer it does get easier to detect though it is harder to detect on the mobile devices.

I would probably do something like having a key table for the last two keys pressed, and check the inputs with UIS if I really wanted to detect if a player willingly left or not.

True, but even then it can create false positives, someone pressing Alt and just happening to disconnect can’t really mean much

1 Like

That’s fair, mentioning the various cases where someone could leave. However, there should at the very least be a way to distinguish a disconnection from any other method of leaving.

The developer has several methods to get around this situation. He doesn’t necessarily need to punish anyone, instead, he can simply reward player2 who was going to kill, as if player1 exit already counted as his death.

Just a system that if a player is in combat and leaves, the system will consider him dead to avoid players running away.

Instead of punishing players who ragequit, reward the players that don’t. That way the players who stay will make progress in the game but the players who leave won’t make any progress.