TransWikia.com

Get all players at specific X, Y, -OR- Z position

Arqade Asked on July 22, 2021

Is there a way to find a player at a specific Y position? I tried the command:

kill @a[y=177]

but this obviously didn’t work since it just searches for a player starting the search at Y 177. Could I accomplish something that returns all players at a Y level? (I assume the command would be the same for X and Z, and to keep the post as covering as possible I have put all in the title, hence why the -OR- is written like that.)

One Answer

x, y, z, dx, dy, and dz selectors can declare a box to find a player in.


Consider @a[x=5,y=24,z=-10,dx=5,dy=0,dz=4]
This defines a box starting at (5, 24, -10) and extending to (5+5, 24+0, -10+4) [which evaluates to] (10, 24, -6). Any player standing with their feet in these blocks will be selected. So, dy = 0 actually means that the box is one block high.

(u/TinyBreadBigMouth, Reddit Thread)

Correct answer by Penguin on July 22, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP