i need to know how make it so when you join a server your team is "spectator" and when only one person on team "alive" is left, it kills everyone in the server and switches their team to "alive" and when you die your team changes to "spectator"
You can connect a function to the PlayerAdded event of the Players Service, which will fire when a player joins the server. In that function, there you set the Team property of the player to the Spectator team object.
You can check if a player died by using the Died event of the player's humanoid, which will fire when the humanoid has been killed. In the event, you'll compare if the number of the alive players is less than or equal to 1.