TransWikia.com

How can you teleport behind a player?

Arqade Asked on August 4, 2021

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.

2 Answers

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 : )

Answered by roisHh on August 4, 2021

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.

Answered by ExpertCoder14 on August 4, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP