I'm trying to implement player rotation in order to work with the teleport argument, as such:

/tp [target player] <x> <y> <z> [<y-rot> <x-rot>]

But in this command instead:

/execute positioned ~ ~-1 ~ if entity @e[distance=..5] run tp @p ~12 ~15 ~

Is it possible?

  • If it works with the regular /tp command, then why wouldn't it work with that command? The best thing you can do is to just try it out. I think the command likely won't do what you expect, but it should work. – user232393 Aug 2 at 7:25
  • @bearb001 It somehow doesn't work when I add the "[<y-rot> <x-rot>]" argument. The relative coordinates after the /tp command go red. Maybe I'm typing the degrees in the wrong place? – Aless Aug 2 at 12:32
  • It works for me, what command do you use exactly when you add the rotation? Does it work without the execute positioned ~ ~-1 ~ if entity @e[distance=..5] run part? – user232393 Aug 2 at 12:42
  • @bearb001 I'll try that out, one second. – Aless Aug 2 at 13:18
  • @bearb001 Strange, works perfectly now even with the execute positioned ~ ~-1 ~ if entity @e[distance=..5] run part. It might've been a typo I made or something. Thanks for the help anyways! – Aless Aug 2 at 13:23

The autocomplete of /execute is a bit messed up. For example it only shows as when you enter /execute rotated. But you can still do this:

/execute rotated 12.3 ~-45.6 run <command>

This is also documented here (archive).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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