Ok I have this function here that checks the amount of players on a team:

function getTeam(team)
    local players = game.Players:GetPlayers();
    local teamPlayers = {};
    for _, player in pairs(players) do
        if player.TeamColor == team.TeamColor then
            table.insert(teamPlayers, player);
        end
    end
    return teamPlayers;
end

And then I used it to start another function.

function waitforwinner()
if #getTeam(game.Teams.Survivors) == 0 then
        m = Instance.new("Message",Workspace)
            m.Text = "The final survivor was infected. Once you respawn the round will begin!"
        wait(3)
    m:Destroy()        
        for i,v in pairs(game.Players:GetPlayers()) do
            if v.TeamColor == BrickColor.new("Bright orange") then
            v.StarterGear.Revolver:remove()
        end
            v.Character.Humanoid.Health = 0
            wait(1)
            v.TeamColor = BrickColor.new("Bright blue")
            wait(5)        
        begin("The round has begun.",3)
        GiveGun()
        FirstInfected("A player has been randomly infected!",3)
        waitforwinner()
        waitForWinner()
        end
        end
end

The problem is that the getTeam function only checks once. So is there a way to make it so that function keeps checking so the second function will know when to work?