How can you teleport behind a player?
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.
Best Answer
The other answer is almost correct. Try this:
execute
as @p[distance=0.1..]
at @s
run tp @p ^ ^ ^-1 facing entity @s
This command is to be run by the assassin.
Pictures about "How can you teleport behind a player?"
What is the command to teleport a player in Minecraft?
You can teleport to a set of coordinates or teleport another player using the /tp command in Minecraft (see also /teleport command).How do you let players teleport?
What to KnowHow do you teleport to another player in Roblox?
In Roblox, TeleportService:TeleportAsync handles teleporting players between places in a universe or even to another experience. This method accepts three parameters: The place ID that the player(s) teleport to. An array containing the Player instances to teleport.What is the command for teleporting?
To teleport, tap the Chat icon once again, bring up the text box and type /tp YourUsername X Y Z, with X representing the east/west coordinate, Y representing the vertical coordinate and Z representing the north/south coordinate.Minecraft tutorial: Teleport where you look
More answers regarding how can you teleport behind a player?
Answer 2
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 : )
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.