Bedwars Game + Lobby

Hello, I have such an unusual question? Does anyone know how to make a bedwars + lobby game style? I have already searched everything on the internet and I have already tried but unfortunately I have not succeeded. I would be very grateful if someone could help me make a game with (Spawn) (Respawn) + team change (Team Index). It would be done as follows: The game starts in the Lobby, you have 30 seconds to join a team (if you do not join, you die and enter spectator mode. Then after choosing a team, there should be the first and subsequent respawns until the bed collapses on the island, e.g. (Blue) if a team drops out, so that you can watch other players until the end of the game PLEASE HELP :pleading_face: