I'm trying to build a teleport system in Minecraft, but the command blocks that have the teleport command (/tp @p x y z) are far away from the pressure plate I use to activate it. I use this world with other people, so I'm worried that other people might be closer to the command blocks than I am, and they will accidentally get teleported.

Is there any way to make it so the command blocks teleport the closest person to a certain set of coordinates instead of the command block itself?

  • why not put the block next to the pressure plate? Commented Dec 24, 2013 at 9:11
  • @ratchetfreak I can only speculate, maybe he wants a switch where you can deactivate the teleporter.
    – Andalur
    Commented Dec 24, 2013 at 10:04

3 Answers 3


Yes, you can. It's pretty simple, use the following code:

/tp @p[x=0,y=0,z=0,r=0] *tp coordinates*

Where the values x, y, z define the center of the search (the player nearest to these coordinates would get teleported) and r defines the radius of the search. If you don't want to limit the radius omit r.

Do not use decimal values for the search center, this will not work.

See here for more info.

  • 3
    You may want to mention the wiki page which contains those arguments, plus more: minecraft.gamepedia.com/Command_block#Arguments
    – IQAndreas
    Commented Dec 24, 2013 at 10:30
  • 3
    Also, you can use the r argument to set the radius, and only pick the nearest player if he also is within a certain radius of that center (in case there is more than just a pressure plate that you want to trigger the redstone).
    – IQAndreas
    Commented Dec 24, 2013 at 10:32
  • This answer is outdated, updated answer.
    – Penguin
    Commented Dec 9, 2020 at 23:25

It would most likely make it much easier if the command blocks were directly adjacent or one redstone-conducting block away. I don't know if this would be inconvenient for you, because I can't see how your command blocks are set up in your world.


Updated Answer

The command would be:

/tp @p[x=0,y=0,z=0] 5 10 5

to teleport a player to 5, 10, 5. To specify a radius:

/tp @p[x=0,y=0,z=0,distance=..1] 5 10 5

That command tests for a distance of 1 or smaller.

  • The change seems to have taken place in 1.13, but I can't confirm. If someone could confirm that would be great.
    – Penguin
    Commented Dec 9, 2020 at 23:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .