How do you make a command block so that when you die it activates a title

I'm making a space map and I've made a fake entrance for intruders. I was wondering how to:

  • create a title on a command block
  • how to create it so that when you die, it is activated

Solution 1:

There's a scoreboard type for this:

/scoreboard objectives add numberOfDeaths deaths

Now you can do things to players that have died: `@a[scores={numberOfDeaths=1..}]

And then reset afterwards:

/scoreboard players reset @a numberOfDeaths

If you want to delay actions until the player has respawned, try this: https://gaming.stackexchange.com/a/354738/171580