I need a command block to teleport me 5 blocks upwards when I'm near. So I wrote this command:
tp @a[distance=..2] ~ ~5 ~
Unfortunately, that command teleported me to the middle of the block. That means, even if I stood at the edge of the block I would still get teleported to the center. However when I use classic /tp @s ~ ~5 ~ in my command prompt / chat it works fine. Do anyone know how to make it teleport me directly upwards?
I tried using this command as well but it didn't help:
I think it's an issue with your target selector distance.
Try something similar to one of the following. (I don't use Java but this should work.)
execute as @a[x=Xmin,y=yMin,z=Zmin,dx=xArea,dy=yArea,dz=zArea] run tp @s ~ ~4.5 ~
or
execute as @a[x=Xmid,y=yMid,z=Zmid,r=Radius] run tp @s ~ ~4.5 ~
I think it's having an issue with defining the distance. In Bedrock we don't have it but what I gave you above will force it to define an area that you want this effect to occur.
The difference between the 1st and 2nd command. Note the Xmid, Ymid, and Zmid would be the coordinate of the middle spot or where your CB might be
Note xMin, yMin, zMin, Are the minimum spots and your dx, dy, dz is the x,y,z area. This is the most exact way to do it but can be a lot to type.
I need a command block to teleport me 5 blocks upwards when I'm near. So I wrote this command:
Unfortunately, that command teleported me to the middle of the block. That means, even if I stood at the edge of the block I would still get teleported to the center. However when I use classic /tp @s ~ ~5 ~ in my command prompt / chat it works fine. Do anyone know how to make it teleport me directly upwards?
I tried using this command as well but it didn't help:
Try doing @a in your execute instead of @s.
Nope, didn't work, unfortunately.
I think it's an issue with your target selector distance.
Try something similar to one of the following. (I don't use Java but this should work.)
execute as @a[x=Xmin,y=yMin,z=Zmin,dx=xArea,dy=yArea,dz=zArea] run tp @s ~ ~4.5 ~
or
execute as @a[x=Xmid,y=yMid,z=Zmid,r=Radius] run tp @s ~ ~4.5 ~
I think it's having an issue with defining the distance. In Bedrock we don't have it but what I gave you above will force it to define an area that you want this effect to occur.
The difference between the 1st and 2nd command. Note the Xmid, Ymid, and Zmid would be the coordinate of the middle spot or where your CB might be
Note xMin, yMin, zMin, Are the minimum spots and your dx, dy, dz is the x,y,z area. This is the most exact way to do it but can be a lot to type.