Players left in team

Im trying to figure out a way to tell how many players are left in a team on my Fretta gamemode, first I treid total players - players dead but turned out that was total players dead even from last round. So what im asking is what is the best way to tell how many players are alive in a team.

[lua]
local AliveCount = 0

for k,v in pairs(team.GetPlayers(TEAM_WHATEVER)) do

if v:Alive() then

    AliveCount = AliveCount+1
end

end
[/lua]

Thanks for the help,
I was trying to do something like that but its the alive count variable that I couldent think off, I feel stupid