Minecraft – Teleporting a player from one block to another

minecraft-commandsminecraft-java-edition

So the problem I have here is I want to teleport a player standing at 1 34 70 to 273 33 -5.

I have tried using a clock with testfor @a [x=1.3,y=34,z=70] hooked up to a tp @p 273 33 -5 but when I go to 1 34 70 I don't get teleported.

Best Answer

I can see several issues with your setup.

  • First of all, there is no need for testfor here. The beauty of target selectors is that they work the same in all commands, including tp.
  • Secondly, there must not be a space between @a and the [] (the target selector arguments)
  • You can specify a radius with your target coordinates in order to make the detection more reliable. I am not sure which value the game assumes by default, but manually setting it to 1 can't hurt.

All things considered, the command you are looking for is simply

tp @a[x=1,y=34,z=70,r=1] 273 33 -5

or using 4 argument shorthand:

tp @a[1,34,70,1] 273 33 -5