I am making a map on Minecraft 1.17.1 and I'm tying to make a challenge where you need to go through the correct tunnel, if you go through the wrong one you'll get teleported to the start.

I don't know how to do it, so I "tried" using the execute command but I don't know how to really use it.

  • I'm not someone that develops lots of things in MC but wouldn't it work to just have a pressure plate that when pressed throws a command that sends a command that tps your player?
    – Fredy31
    Oct 5 at 18:18

This can be easily achieved with a command block and the tp command:

tp @p[distance=..4] x y z

Where x, y, and z are the respective coordinates of your starting position.

Give yourself a command block with:

give @s command_block

Place it where it can be concealed (e.g. under a block in the tunnel) and set it's configuration to:

  • Block Type: Repeat
  • Condition: Unconditional
  • Redstone: Always Active
  • Command Input: tp @p[distance=..4] x y z
    • Where x, y, and z are the respective coordinates of your starting position.
  • This is a minecraft-java-edition question. You seem to have posted a Bedrock Edition screenshot, and a command that hasn't worked on Java Edition since 1.13.
    – pppery
    Oct 6 at 22:39
  • @pppery oops, in my multi-tasking state I failed to swap the syntax over. The UI for the command block, IIRC, is the same in Java edition though. However, I'm just going to remove it because I can't confirm for another few hours. Oct 6 at 22:43
  • The correct java edition syntax is /tp @p[distance=..4] x y z. Whether you use /tp or /teleport doesn't matter.
    – pppery
    Oct 7 at 0:03
  • @pppery thanks, I'm still new to Java edition; thanks for the clarity! Oct 7 at 0:08

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.