Minecraft Command?
Hello, I want to create a Minecraft command that checks whether a player is within a distance of 5 blocks from the coordinates x=1 and z=1 and if this is NOT the case a tp command should be executed.
Unfortunately I can't find the right code for it, which is why I'm asking here.
Play Minecraft Java Edition.
Thank you!
You’ll get the player’s position and get the X and Z coordinates from the result, then you’ll see if the coordinates are both larger than X+5 and Z+5/ and smaller than -X-5 and -Z-5 (because of the negative coordinates) and if that applies (“true”) you’ll execute the command.