I want to do a hide and seek game by commands.
When a player is dead, if they are in a certain team, then summon something like a flag. If on the opposite team then summon another flag.

  • Welcome to Arqade. I tried to rephrase but it's actually hard to understand what you mean.
    – pinckerman
    Dec 22, 2022 at 11:45
  • 3
    Possible duplicate of How do you detect a player's death?
    – pppery
    Dec 22, 2022 at 16:31
  • @pppery that's a very old post, and the /testfor command doesn't work for newer versions. You have to use /execute if, instead.
    – Blue Robin
    Dec 23, 2022 at 3:50
  • 2
    Sigh. Question age is irrelevant when determining duplicates. I posted a comment on the answer explaining how to update it to 1.13 syntax way back in 2019.
    – pppery
    Dec 23, 2022 at 6:22
  • 2
    @pppery instead of a comment, you should make a new answer and explicitly say "for version 1.13+" or something to that end.
    – Timmy Jim
    Dec 23, 2022 at 16:39

1 Answer 1


First, you would create a scoreboard death count to check for deaths:

/scoreboard objectives add death deathCount 

Then, you would check for deaths via the:

/execute if entity @a[gamemode=survival,scores={death=1}]

And then in chain commands connected to it, you would do:

scoreboard objectives remove death

scoreboard objectives add death deathCount

I tested this, and it does work. However, it does produce a lot of output in chat. You can disable this via:

/gamerule commandBlockOutput false

Not the answer you're looking for? Browse other questions tagged .