#built using mc-build (https://mcbuild.dev/)

scoreboard players add order id 1
execute store result score max id if entity @a[tag=ready]
execute if score order id = max id run scoreboard players set order id 0
execute as @a[team=ingame] if score @s id = order id run function main:check