I'm making a multiplayer map, and I need to teleport a player from one place to another. However, I have all the command blocks set up at a separate area, so I cant just say /to @p [x y z]. Is there any way to teleport a player from one particular spot to another?
2 Answers
You can use this @a[x=~,y=~1,z=~,dx=0,dy=0,dz=0]
to target any player who is on top of the command block that is executing the command.
This command will teleport any player at the coordinates 100 50 100
to 150 60 150
:
/tp @a[x=100,y=50,z=100,dx=0,dy=0,dz=0] 150 60 150
-
I haven´t tested that command in the java edition, but it should work there, too– user232393Commented Jun 19, 2019 at 15:47
If you wanna check for a specific block. Use this one:
execute @a ~ ~ ~ /testforblock ~ ~-1 ~ <name of block>
Then use a redstone comparator to activate the second command block which is using to teleport player around.