im trying to use a command where a repeating command block teleports someone to a spot but my command doesnt work

I was looking for a command and I found this:

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

Where:

  • a, b, and c are the XYZ coordinates 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)

My command turned out to be:

execute @a[-122,4,-74,999] ~ ~ ~ tp @-124 27 -74

It doesn't work and I don't know why.


Solution 1:

Firstly, the command you found is outdated. It is for pre-1.13 versions of Minecraft.

Secondly, the simplest usage to teleport someone to a spot would be this:

tp Steve -124 27 -74

It seems that this is a working solution to your problem.

To only teleport a player's inside the coordinate 122 4 999, use:

tp @a[x=-122,y=4,z=999,dx=0] -124 27 -74