0

I've seen a lot of tutorials for detecting the player at certain X,Y,Z coordinates, but I want to detect only the player's Y coordinate. In this situation I want to detect the player at Y level 18. I tried things like execute if entity @a[y=18.5,distance=1.5] but that doesn't work. execute if entity @a[x=~,y=18.5,z=~,distance=1.5] doesn't work either. Do I need different commands?

  • ⬆️ Just leave out the execute part from that answer. – Fabian Röling Oct 31 '18 at 10:16
0

You don't need to specify x and z, so you want something like

execute if entity @a[y=18] run yourcommand

Or if you want to detect players between 18 and 19, use

execute if entity @a[y=18..19] run yourcommand
| improve this answer | |
  • I get the following error when trying to use the second command: Invalid double '18.19' – haykam Jan 3 at 2:24
  • @haykam Probably a typo, you need 2 dots between the numbers 18 and 19. You have only 1 dot. – Tabin1000 Jan 3 at 6:30

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