Join Leave Signs
Signs that players can join or leave your minigames!
Supported Versions:
1.21.10+26.1+
Commands by Row:
Row 1
1. [impulse] /scoreboard objectives add joinSign trigger
Row 2
2. [impulse] /scoreboard objectives add leaveSign trigger
Row 3
3. [impulse] /scoreboard objectives add playerCount dummy
Row 4
4. [impulse] /setblock ~ ~1 ~ minecraft:oak_sign{front_text:{messages:["",{"text":"Leave Game","color":"#FF9BFF","click_event":{"action":"run_command","command":"/trigger leaveSign add 1"}},"",""]}}
Row 5
5. [repeat] /scoreboard players enable @a[tag=!joinedSign] joinSign
6. [chain] /execute as @a at @s if score @s joinSign matches 1.. run tag @s add joinedSign
7. [chain] /execute as @a at @s if score @s joinSign matches 1.. run tp @s ~ ~10 ~ 0 0
8. [chain] /execute as @a at @s if score @s joinSign matches 1.. run scoreboard players add testGame playerCount 1
9. [chain] /execute as @a at @s if score @s joinSign matches 1.. run scoreboard players reset @s joinSign
Row 6
10. [repeat] /scoreboard players enable @a[tag=joinedSign] leaveSign
11. [chain] /execute as @a[tag=joinedSign] at @s if score @s leaveSign matches 1.. run tp @s ~ ~20 ~ 0 0
12. [chain] /execute as @a[tag=joinedSign] at @s if score @s leaveSign matches 1.. run scoreboard players remove testGame playerCount 1
13. [chain] /execute as @a at @s if score @s leaveSign matches 1.. run tag @s remove joinedSign
14. [chain] /execute as @a at @s if score @s leaveSign matches 1.. run scoreboard players reset @s leaveSign
Row 7
15. [impulse] /execute as @a[tag=joinedSign] at @s run tp @s ~ ~5 ~ 0 0
16. [chain] /execute as @a[tag=joinedSign] at @s run tag @s remove joinedSign
17. [chain] /scoreboard players reset testGame playerCount
Row 8
18. [repeat] /execute unless score testGame playerCount matches 0..10 run scoreboard players set testGame playerCount 0
19. [chain] /setblock ~ ~1 ~ minecraft:oak_sign{front_text:{messages:[{"text":"Join Game","color":"#FF9BFF","click_event":{"action":"run_command","command":"/trigger joinSign add 1"}},[{"score":{"name":"testGame","objective":"playerCount"}}, "/10"],"",""]}}
Too lazy to copy and paste each command?