I want to teleport an armor stand with this command:

execute as @p at @s run tp @e[type=minecraft:armor_stand] ^ ^ ^3

This works well but when the player looks down or up the armor stand changes its height. So how can I teleport it to the players height?


You will need to execute the command using the rotated subcommand to force the command to execute as if the player is not looking up and down. However, because you need to provide both a horizontal and a vertical rotation, you can use tilde ~ notation to choose not to override horizontal rotation.

/execute as @p at @s rotated ~0.0 0.0 run tp @e[type=armor_stand] ^ ^ ^3
| improve this answer | |

I don't quite understand what you want to do, but why not just use relative coordinates?

Try this command:

/execute as @p run tp @e[type=minecraft:armor_stand,limit=1,sort=nearest] ~ ~ ~
| improve this answer | |
  • the armor stand is teleported 3 blocks in front of the player an it should stay there but it should have the same y as the player – Tom Tom May 31 at 18:39
  • im sorry i dont know how to only change the y :( but i think you need to do something with /data... – zombie1111 May 31 at 19:00

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