How do you set a spawn point upon death?

How would you set a player's spawn point when they die? I'm making a map where the way to move on to the next level is by dying. Basically, what I want is a command that will set the player's spawn point to the next level upon death.


Solution 1:

Place a pressure plate down, and under it place a Command Block saying

/spawnpoint @p ~ ~1 ~.

if you want to make it more precise on whom it teleports, you can use

/execute @a[x=?,y=?,z=?,r=0] ~ ~ ~ spawnpoint @s ~ ~ ~