How do I test for a player at specific coordinates?
If I do:
/testfor @p[x=,y=,z=,r=]
It says:
The entity UUID is in an invalid format.
Best Answer
You're scanning for the nearest player, your should scan for all the players.
Solution
/testfor @a[x=X,y=Y,z=Z,r=R]
Where:
- X the x location
- Y the y location
- Z the z location
- R the radius
For example:
/testfor @a[x=64,y=10,z=64,r=5]
(Search for players on coordinates 64,64 at height 10, with a radius of 5 blocks)
Variables
Specify the location:
- @p nearest player
- @r random player
- @a all players
- @e all entities
Specify the values:
- x, y, z coordinate
- r, rm radius (max, min)
- m game mode
- c count
- l, lm experience level (max, min)
- score_name max score
- score_name_min min score
- team team name
- name entity name
- dx, dy, dz volume dimensions
- rx, rxm vertical rotation (max, min)
- ry, rym horizontal rotation (max, min)
- type entity type
Examples:
To test if Alice is online:
testfor Alice
To count the number of players in survival mode within a 3-block radius of (0,64,0):
testfor @a[0,64,0,3,m=0]
To count the number of players currently flying:
testfor @a {abilities:{flying:1b}}
To count the number of zombies within a 20-block radius of (0,64,0):
testfor @e[0,64,0,20,type=Zombie]
Pictures about "How do I test for a player at specific coordinates?"



How do you check if a player is at a certain coordinates in Minecraft?
Enter /position in Minecraft to see your current world position in the top left corner of Minecraft. You can also use the player world position block in your code. This way, no matter where you are in the game world, your code can use your position to do things near you.How do you find the location of a player in Minecraft?
This can be tested out by using stairs, slowly walking up them, using F3 to check the y value while the command is running. The "hi" will appear even if not exactly at the desired y value.(Bedrock) How To detect a player standing on custom coordinates (Minecraft)
More answers regarding how do I test for a player at specific coordinates?
Answer 2
In newer versions of minecraft you can use something like this:
/execute as @a[x=100,y=100,z=100,dx=0,dy=0,dz=0] at @s run <command>
You need to specify delta values for this to work. The coordinates defined with x y z are one corner of the specified area, the delta values dx dy dz define how many blocks the second corner is away from the first corner.
You can also use this command:
/execute positioned 100 100 100 as @a[distance=..1] at @s run <command>
This will execute your command as all players who are within a 1 block radius from the coordinates 100 100 100.
Answer 3
I've noticed that the invalid UUID doesn't always mean that the format is wrong, as I've gotten the error a lot when the format was correct, but no entity was detected. Make sure you are in the area you've specified, and then retry your command.
Answer 4
You would use the testfor command like so:
/testfor @a[x=-682,y=4,z=-188,dx=0]
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: RODNAE Productions, RODNAE Productions, RODNAE Productions, RODNAE Productions
