-1

I am making a game where if the player is at half a heart I want to teleport them to a place. Is it possible to detect player health with command blocks? Thanks.

2

For this method you need a scoreboard for health. You can make it with the following command.

scoreboard objectives add health health

To test if a player has a certain amount of health, you can do it with the following command:

execute as @a[scores={health=<number>}] at @s run tp <coordinates>

Default health is 0–20. Half a heart is 1.

| improve this answer | |
  • Thank you so much! It works perfectly! – darthvader1925 Nov 4 at 19:59

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