2

Currently I try to understand command blocks in minecraft. The next step I try to achieve is to teleport a player, when he steps on a block at specific coordinates. I found many solutions about that, but the solution is always for a case that a player steps on a block (e.g. stone). But I try to execute the command only when the player steps on one specific block. I found this thread which is exactly what I need.

But for some reason it doesn't work. I guess I'm doing something wrong, but I can't figure out what. I try to execute a command when the player steps on the block at coordinates x=-637 y=67 z=620. So I placed a command block below this coordinates and entered the following command:

/execute @a[x=-637,y=67,z=620,r=1] ~ ~ ~ tp @p -640 67 625

But as I said before, it doesn't work. I don't want to do it with a pressure plate. The player should not see that there's something special. I'm using Minecraft version 1.10.2.

Any help very appreciated.

13
  • Is the command block a repeating command block that is activated?
    – Reflexive
    Commented Mar 6, 2017 at 18:44
  • Yes, I set it to "Repeat" and "Always active"
    – Roman
    Commented Mar 6, 2017 at 18:44
  • Do you want the player to teleport when standing on stone?
    – Reflexive
    Commented Mar 6, 2017 at 18:59
  • The block doesn't matter on which the player stands. I also tried using "/execute detect" with e.g. "minecraft:grass", but then it executes everytime the player moves on grass, no matter where the player is. Thats not what I'm trying to achieve.
    – Roman
    Commented Mar 6, 2017 at 19:05
  • What error message are you getting in the command block?
    – SirBenet
    Commented Mar 6, 2017 at 19:10

5 Answers 5

2

I will test this when I get access to a desktop, but I belive tp @a[x=?,y=?,z=?,r=1] x y z on repeat should work. It worked for me in 1.7, but I haven't tested this on 1.10 yet.

3
  • The problem is already solved. See the comments under the question. But thx anyway.
    – Roman
    Commented Mar 7, 2017 at 15:22
  • 2
    @Roman You still need to formally mark an answer as correct; keeps it off the homepage.
    – aytimothy
    Commented Jun 21, 2017 at 2:37
  • @aytimothy The problem was solved in the comments by SirBenet. I haven't tested your suggestion so I cannot say if it would work and if it is the answer to the question.
    – Roman
    Commented Jun 21, 2017 at 7:57
0

I would say it would be better to use /tp rather than /execute. They both work the same, but personally I prefer /tp by putting this on a Repeat, Always Active command block:

/tp @a[x=number,y=number,z=number,r=1] x y z

0

Try /tp @a[r=R] x y z where:

  • R is the radius of selection. So, for instance, if the block is two blocks under the spot you want players to teleport from, you would set R=3. Note that this is radius, which means that players in any direction within three blocks will be teleported. Therefore, place the command block as close to the target spot as possible and block off any other spots players might get teleported from, so as to prevent them from getting teleported as well.
  • (x,y,z) is the target destination.

Plug this into a command block on repeat and always active, and you're golden.

-1

Try the command:

/execute @a -637 67 620 tp @a[r=1,c=1] -640 67 625

This will teleport everybody in a radius of 1 block from the coordinates -637 67 620 to the coordinates -640 67 625.

1
  • The /execute command is causing all online players to run a command to target all players in a particular location. This causes unnecessary processing of commands and selectors; the first player that runs /tp will have removed those players from the area, and then all other players are still going to be running a /tp command, except they will all fail while still having to process the selector anew just to find no players. You should only be using /execute if the origin or sender needs to be changed, which is not needed here.
    – Skylinerw
    Commented Apr 18, 2017 at 1:43
-2
/execute @a -637 67 620 tp @p -640 67 625

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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