execute if score .time_till_tp countdown matches 1.. run scoreboard players remove .time_till_tp countdown 1
execute if score .time_till_start countdown matches 1.. run scoreboard players remove .time_till_start countdown 1

execute if score .time_till_tp countdown matches 199 run title @a[tag=!playing] actionbar {"text":"10","color":"yellow"}
execute if score .time_till_tp countdown matches 199 as @a[tag=!playing] at @s run playsound minecraft:ui.button.click player @s ~ ~ ~ 1 0.5

execute if score .time_till_tp countdown matches 180 run title @a[tag=!playing] actionbar {"text":"9","color":"yellow"}
execute if score .time_till_tp countdown matches 180 as @a[tag=!playing] at @s run playsound minecraft:ui.button.click player @s ~ ~ ~ 1 0.65

execute if score .time_till_tp countdown matches 160 run title @a[tag=!playing] actionbar {"text":"8","color":"yellow"}
execute if score .time_till_tp countdown matches 160 as @a[tag=!playing] at @s run playsound minecraft:ui.button.click player @s ~ ~ ~ 1 0.8

execute if score .time_till_tp countdown matches 140 run title @a[tag=!playing] actionbar {"text":"7","color":"yellow"}
execute if score .time_till_tp countdown matches 140 as @a[tag=!playing] at @s run playsound minecraft:ui.button.click player @s ~ ~ ~ 1 0.95

execute if score .time_till_tp countdown matches 120 run title @a[tag=!playing] actionbar {"text":"6","color":"yellow"}
execute if score .time_till_tp countdown matches 120 as @a[tag=!playing] at @s run playsound minecraft:ui.button.click player @s ~ ~ ~ 1 1.1

execute if score .time_till_tp countdown matches 100 run title @a[tag=!playing] actionbar {"text":"5","color":"yellow"}
execute if score .time_till_tp countdown matches 100 as @a[tag=!playing] at @s run playsound minecraft:ui.button.click player @s ~ ~ ~ 1 1.25

execute if score .time_till_tp countdown matches 80 run title @a[tag=!playing] actionbar {"text":"4","color":"yellow"}
execute if score .time_till_tp countdown matches 80 as @a[tag=!playing] at @s run playsound minecraft:ui.button.click player @s ~ ~ ~ 1 1.4

execute if score .time_till_tp countdown matches 60 run title @a[tag=!playing] actionbar {"text":"3","color":"yellow"}
execute if score .time_till_tp countdown matches 60 as @a[tag=!playing] at @s run playsound minecraft:ui.button.click player @s ~ ~ ~ 1 1.65

execute if score .time_till_tp countdown matches 40 run title @a[tag=!playing] actionbar {"text":"2","color":"gold"}
execute if score .time_till_tp countdown matches 40 as @a[tag=!playing] at @s run playsound minecraft:ui.button.click player @s ~ ~ ~ 1 1.8

execute if score .time_till_tp countdown matches 20 run title @a[tag=!playing] actionbar {"text":"1","color":"red"}
execute if score .time_till_tp countdown matches 20 as @a[tag=!playing] at @s run playsound minecraft:ui.button.click player @s ~ ~ ~ 1 1.95

execute if score .time_till_tp countdown matches 1 run function pctf:logic/lobby/attempt_to_tp

execute if score .time_till_tp countdown matches 1.. as @a[team=lobby] run title @s subtitle {"text":"You have not joined a team!","color":"red"}
execute if score .time_till_tp countdown matches 1.. as @a[team=lobby] run title @s title ""