I managed a KitPvP server in Minecraft and everything works fine except when players wants to duel each other. They get sent to a room where they will be dueling. The main problem is when the winner wins, I have no idea how to teleport them back to spawn.
Minecraft – How to teleport a certain player to spawn after they win a 1v1
minecraft-commandsminecraft-java-editionminecraft-java-edition-server
Best Answer
Check for the other person not being there. You can do this by tagging an arbitrary player inside the room (would be the only one if he/she won), then checking if there's another untagged one and then removing the tag again:
Replace "
…
" with the lowest coordinates and the size of the room and "<command>
" with whatever you want to do with the winning player (for example teleportation). If you want to do it relative to that player's location, add "at @s
" before "run
".