Minecraft – way to teleport a player with a deathCount of 1

minecraft-commandsminecraft-java-edition

I am making a skywars map and I am almost finished, I just need to
teleport players with the deathCount of 1 back to the islands while turning them into gamemode 3 (spectator). Is there a way to only teleport the dead players, but keep the alive players still at their places? I don't want to use a fake player or anything, I just need the tag for the scoreboard that isn't [team="team name"]. I need something to testfor the deathCount objective on the scoreboard.

For example, with /testfor @a[Q=1] with Q as deathCount, what would Q be?

Best Answer

You can use a scoreboard objective to count deaths.

/scoreboard objectives add deaths deathCount will create an objective to count deaths.

You can then /tp @a[score_deaths=1,score_deaths_min=1] <wherever>

Of course, you would need to reset the score when the game is over.