execute store result storage pctf:map input.map_id int 1 run scoreboard players get .selected_map lobby
execute as @a run scoreboard players operation @s on_map = .selected_map lobby
function pctf:logic/game/count_players with storage pctf:map input
execute if score .player_state temp matches -1 unless entity @a[tag=ignore_not_enough_players] run return run function pctf:logic/lobby/not_enough_players

# teleport players
title @a actionbar {"text":"Teleporting to game lobby...","color":"yellow"}
execute as @a[team=!lobby] run function pctf:tp/map with storage pctf:map input

# start game
function pctf:logic/game/start with storage pctf:map input
scoreboard players set .game_in_progress lobby 1