I am currently making a gravestone system in minecraft with command blocks, and that means I need to run a command at the location of a player before they die.

I have tried the obvious answer, executing on a player when their deaths score increases: (deaths is a scoreboard tracking deathCount)

execute @e[score_deaths_min=1] ~ ~ ~ summon minecraft:armor_stand

however this summons the armor stand after the player respawns because it can't find the player when they are dead

I also tried teleporting a mob to a player when they die, however the mob can't be teleported to a dead player either:

summon minecraft:armor_stand 0 1000 0 {CustomName:"deadplayer",NoAI:1b,NoGravity:1b,Invisible:0b,Invulnerable:1b}

tp @e[name=deadplayer] @e[score_deaths=1]
function graves:playerdied unless @e[name=deadplayer,x=0,y=1000,z=0,r=5]
kill @e[name=deadplayer]

function graves:playerdied:

execute @e[name=deadplayer] ~ ~ ~ summon minecraft:armor_stand

This does the exact same thing, spawning the armorstand in the player when they click respawn, but not at their death point.

How can I spawn an armorstand or execute commands at the death point of a player, not where they respawn?


@e cannot target dead players. Only the @a selector can (as well as the upcoming @s selector, though is irrelevant when you'd need to use @a first for @s to be functional), and only if the r/dx/dy/dz parameters are not specified.

execute @a[score_deaths_min=1] ~ ~ ~ summon minecraft:armor_stand
  • @s is no longer upcoming. – pppery Jun 15 '20 at 2:38

Just use the @a instead, it can detect dead players.

  • What does this add to Skylinerw's answer? – pppery Jun 15 '20 at 2:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.