#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#
#    This function has been created by Skilendarz Group.
#             https://skilendarz.com
#
#      GIVE MAP MAKERS THE CREDIT THEY DESERVE!
#             COPYING IS PROHIBITED!
#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#


execute unless entity @p[team=blue,tag=!checked] run team join blue @r[team=random]
execute unless entity @p[team=red,tag=!checked] run team join red @r[team=random]
execute unless entity @p[team=green,tag=!checked] run team join green @r[team=random]
execute unless entity @p[team=yellow,tag=!checked] run team join yellow @r[team=random]

tag @p[team=blue,tag=!checked] add checked
tag @p[team=red,tag=!checked] add checked
tag @p[team=green,tag=!checked] add checked
tag @p[team=yellow,tag=!checked] add checked

execute if entity @p[team=random] run function f:game/start/team