Balanced Team Select with Countdown (Sort of like Arsenal)

How would I create a balanced team select GUI that locks one button after that team is full (5 players)? And after the team select time is over (it still appears for people who join mid game) everyone goes to their teams and a countdown starts (that does not reset when someone joins and picks a team) and then the team select appears again?