How to Teleport Players When They Enter a Certain Area/Coordinates

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.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.