How to track player's height level?

How to track player's height level? - Aerial view of curvy road in lush forest

I would really like to know if it's possible to track "how high" the player is and link it to another command.

For example, if the player is above or crossed height level of 240, it would trigger a set of commands (tp ~ ~-100 ~ as an example).



Best Answer

Have a command block on a fast clock with

testfor @a[y=240]

Have a comparator coming out of that command block and into another one. In that new command block put

tp @a ~ ~-100 ~

Of course you can change the values and if you want it only for specific players. As long as they start under 240 y or if they start above and fall to 240 y they will be teleported. If you have any questions, feel free to contact me.




Pictures about "How to track player's height level?"

How to track player's height level? - Back view of unrecognizable hikers with trekking poles traveling in green hilly valley
How to track player's height level? - Straight roadway among mountains under clouds
How to track player's height level? - Aerial view of asphalt curvy roadway running amidst abundant forest during clear summer day





Football player tracking explained in 2 minutes




Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

Images: Pok Rie, Vicky Tran, Naren Y, Kelly