Is there a way I can use command blocks or datapacks to kill a player BEFORE they leave the game?
I want to install it in my multiplayer server, so when someone leaves the game their items will be dropped on the ground so other players can take them.
I’ve already tried this:
<code>/scoreboard objectives add playerLeft minecraft.custom:minecraft.leave_game
</code>
<code>/scoreboard objectives add playerLeft minecraft.custom:minecraft.leave_game
</code>
/scoreboard objectives add playerLeft minecraft.custom:minecraft.leave_game
Command Block | Repeat | Always Active:
<code>/execute as @a[scores={playerLeft=1..}] run kill @s
</code>
<code>/execute as @a[scores={playerLeft=1..}] run kill @s
</code>
/execute as @a[scores={playerLeft=1..}] run kill @s
Command Block | Chain | Conditional | Always Active:
<code>/scoreboard players reset @a[scores={playerLeft=1..}] playerLeft
</code>
<code>/scoreboard players reset @a[scores={playerLeft=1..}] playerLeft
</code>
/scoreboard players reset @a[scores={playerLeft=1..}] playerLeft
The problem is the player is being killed AFTER returning to the game.
I need the player dead BEFORE leaving the game…