execute if score .host_mode settings matches 1 unless entity @s[tag=op] run return run tellraw @s {"text":"\nYou do not have permission to toggle this in Host Mode! To toggle Host Mode an operator must type `/function pctf:host_mode/toggle`","color":"red"}
scoreboard players add .auto_balance settings 1
execute if score .auto_balance settings matches 2.. run scoreboard players set .auto_balance settings 0

execute if score .auto_balance settings matches 0 run setblock 18 101 8 oak_wall_sign[facing=west]{front_text:{messages:[{"text":"TOGGLE","color":"yellow","bold":true,"click_event":{"action":"run_command","command":"/function pctf:logic/lobby/auto_balance/toggle"}},{"text":"Auto Balance","color":"white"},{"text":"Teams","color":"white"},{"text":"OFF","color":"red","bold":true}]},is_waxed:1b} destroy
execute if score .auto_balance settings matches 1 run setblock 18 101 8 oak_wall_sign[facing=west]{front_text:{messages:[{"text":"TOGGLE","color":"yellow","bold":true,"click_event":{"action":"run_command","command":"/function pctf:logic/lobby/auto_balance/toggle"}},{"text":"Auto Balance","color":"white"},{"text":"Teams","color":"white"},{"text":"ON","color":"green","bold":true}]},is_waxed:1b} destroy

execute if score .auto_balance settings matches 0 run setblock -2 101 8 oak_wall_sign[facing=east]{front_text:{messages:[{"text":"TOGGLE","color":"yellow","bold":true,"click_event":{"action":"run_command","command":"/function pctf:logic/lobby/auto_balance/toggle"}},{"text":"Auto Balance","color":"white"},{"text":"Teams","color":"white"},{"text":"OFF","color":"red","bold":true}]},is_waxed:1b} destroy
execute if score .auto_balance settings matches 1 run setblock -2 101 8 oak_wall_sign[facing=east]{front_text:{messages:[{"text":"TOGGLE","color":"yellow","bold":true,"click_event":{"action":"run_command","command":"/function pctf:logic/lobby/auto_balance/toggle"}},{"text":"Auto Balance","color":"white"},{"text":"Teams","color":"white"},{"text":"ON","color":"green","bold":true}]},is_waxed:1b} destroy

execute if score .auto_balance settings matches 0 run playsound minecraft:block.note_block.bit player @s ~ ~ ~ 1 0
execute if score .auto_balance settings matches 1 run playsound minecraft:block.note_block.bit player @s ~ ~ ~ 1 2