Minecraft 1.16.5 - Teleport a player to a given location if on given coordinates

I already tried this link and many other, but it doesn't work. I think it's because I use a newer version and the commands are not the same.

I want to teleport every player to 83 15 -177 if he is on the block 171 14 169

I already tried these commands:

  • /execute @a[x=-71,y=14,z=169] run tp @p 83 15 -177 this command won't work because first you have to put after the /execute a subcommand
  • /execute at @a[x=-71,y=14,z=169] run tp @p 83 15 -177 here it teleports me all the time

Can someone give the command that it only will tp me if im on the above given coordinates for the version 1.16.5?


Command:

tp @a[x=171,y=14,z=169,distance=..0.5] 83 15 -177

How you can use this:

  1. Give yourself a command block.
    /give @s command_block
    2. To avoid having your chat being over run by messages, set gamerule CommandBlockOutput to false.
    /gamerule commandBlockOutput false
    3. Go to the purple block and stand on top of it. Once you are standing on the block, hold shift + f3 to find your coordinates. These will be referred to as x1, y1, and z1.
    (Optional) Type your coordinates into chat to help you remember them.
    4. Now, go to the red block, and repeat step 3. These will be referred to as x2, y2, and z2.
    5. Now, go to where you want the command block to be placed, and place it there.
    6. Right-click your mouse on it, and change Impulse to Repeat.
    7. Now change Needs Redstone to Always Active.
    8. Now type tp @a[x=X1,y=Y1,z=Z1,distance=..0.5] X2 Y2 Z2 into the area that says Console Command.
    9. Hit Done.