1

I am trying to teleport a player to certain coordinates once they enter an area.

The idea is that they walk into a really small building, but once they turn a corner, they get teleported into a larger building.

Please refer to the adventure map named '5 Cubed', if you need help understanding what I am asking.

  • 1
    I think you can just put \tp **** **** **** The asterisk being the x, y, and z coordinates. I'm not 100% positive about that though. Also a pressure plate on a block and a command block under that. – zombieatmore Mar 24 '15 at 0:26
  • @zombieatmore This only works in single player. It will only tp the player who uses it. So it is useless for use with command blocks. – angussidney Mar 25 '15 at 10:02
  • @AngusAtkinson I wasn't 100% sure if mine was correct either way so..... – zombieatmore Mar 27 '15 at 10:01
4

1.9 Solution

Place the following command in a repeating command block set to always active:

/execute @a[x=a,y=b,z=c,r=d] ~ ~ ~ tp @p e f g

Where:

  • a, b, and c are the XYZ co-ordinates that you want to teleport players from
  • d is the radius in blocks around that point where players will be selected (min 1)
  • e, f, and g are the XYZ co-ordinates that you want to teleport players to (i.e. the destination)

1.8 Solution

Use the same command as above, but since no repeating command blocks exist, place the command block on a fill clock.

  • Is there a possible way to replace radius with something like, "~ ~ ~"? I'm also looking for a way to test for a player at certain co-ordinates. Is this possible? – Jake Mar 30 '15 at 20:32
  • Yes this is possible, however not by the /tp command. Use a /testfor command – angussidney Mar 31 '15 at 9:32
  • @Jake Try /testfor @a[x=? y=? z=?], with a comparator pointing out of the command block. This will produce a current when a player is at the certain co-ords. – angussidney Mar 31 '15 at 9:35
0

1.13.x solution

If anyone is coming from 1.13.x, the /testfor command has been deleted. In that case if you want to teleport someone you can use the /execute command as thus

/execute if entity @a[x=0,y=0,z=0,distance=..1] run tp @p x y z

The first set of X Y Z coordinates is where you want the player to be teleported from, the second is where you want the player to be teleported to.

-1

Put pressure plates around your desired area. under each pressure plate place a command block that will teleport you to coordinates of your choice. do this by inserting the command /tp @p x y z into your command block.

-2

It's actually quite easy:

Just have a command block that is on a clock, and it should constantly testfor a player at certain co-ords:

/testfor @a[x=???,y=???,z=???]

(copy exactly except replace ? with the co-ords) then put a comparater leading out of it to a command block that:

/tp @p ??? ??? ??? (x,y,z).

You can also do:

/test for @a[x=???,y=???,z=???,r=?] 

Where r is a radius (i.e. if r is 3 it will test for players within 3 blocks in a directions of the co-ords specified.

  • This does not work. This will just teleport the player closest to the command block when any player enters the coordinates. – MrLemon Mar 24 '15 at 16:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.