How to teleport interaction to every player on a multiplayer server on special conditions?

So, I want to do something like this: Any player = any player on a server

  • If any player is sneaking, I want to tp an interaction entity to their head so 1 block up their feet, but if that and only that player is not sneaking, I want to delete that specific interaction entity for the player.

I tried many times and I even succeed but then when I tried with some friends it is working but my deleting system was not good, I delete all interactions then summon them for each player that is sneaking and then tp only 1 interaction to a player, but it was not working.

Drawback of my deleting interaction system: -

  • For example, there is two player, player A and B, now if A and B both are sneaking, a interaction entity for both will get deleted and summoned but only one player has his interaction on his head.
  • Sometime if Player A is already sneaking the interaction is already in his head but when Player B sneaks the interaction gets deleted from player A even though player a is sneaking.
Continue to help post