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 625But 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.
135 Answers
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.
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
Try /tp @a[r=R] x y z where:
Ris 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.
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.
/execute @a -637 67 620 tp @p -640 67 625