I'm trying to make an item for an "assassin" class, where when you hold it, you teleport behind the nearest player. I have found another question, but it only applies to armor stands and doesn't apply to players. So how can you get it to teleport behind the nearest player, preferably looking towards that @p player.

  • /exectye command will help you
    – Ray Wu
    Mar 17 at 23:16

The other answer is almost correct. Try this:

  as @p[distance=0.1..]
  at @s
run tp @p ^ ^ ^-1 facing entity @s

This command is to be run by the assassin.


Try this:

execute as @e[type=player,sort=nearest] run tp @p ^ ^ ^-1

Important: use ^, not ~ to teleport, so you teleport one block behind the nearest players facing direction. Unfortuenetly I don't know how to look towards that @p player. nevertheless, I hope the command will help you : )

  • That unfortunately does not work. Running this command causes me to teleport myself one block backwards, not relative to the nearest player. Please make sure you've tested your commands before attempting. Mar 18 at 0:19

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.