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.
Asked
Active
Viewed 1,714 times
-1
-
5Possible duplicate of Is it possible to check for an injured player in Minecraft? – pppery Nov 05 '20 at 00:09
1 Answers
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.
One 2 Many
- 12,607
- 6
- 48
- 86
randomuser922
- 1,028
- 1
- 6
- 19