execute as @a[distance=..250,team=blue] run tag @s add temp_on_blue
execute as @a[distance=..250,team=red] run tag @s add temp_on_red
tellraw @a[distance=..250] {"text":"EVERYONE HAS SWAPPED TEAMS!","bold":true,"color":"yellow"}
execute as @a[distance=..250,tag=temp_on_blue] run function pctf:logic/lobby/join/red
execute as @a[distance=..250,tag=temp_on_red] run function pctf:logic/lobby/join/blue
title @s times 10 40 10
title @s subtitle ["",{"text":"YOU SWAPPED TEAMS!","color":"yellow"}]
title @s[team=red] title ["",{"text":"RED TEAM","color":"red"}]
title @s[team=blue] title ["",{"text":"BLUE TEAM","color":"blue"}]

execute as @a[tag=has_flag] at @s run function pctf:logic/player/check_flag
execute as @a[distance=..250,gamemode=!spectator] at @s run function pctf:logic/player/armor/check