can some one help me please (gamemode development)

right so am working on a game mode and i want to know is there a way to make if when a player dies it takes away 1 from a variable

now what am showing you is not all of my code just parts of it

----------- shared.lua

//this is the teams

-------------------------- init.lua

//these are the variables
local Red = 0;
local players = 0;
//when a player join the game it adds one to the players variable and when they leave it takes away one

//this is the random gen making one person go to the red team
function playerslives (ply)
	if players >= 2 and players <= 4 then

	local tInd = 1
	local tPlyUnsel = team.GetPlayers(tInd)
	local tPly_count = #tPlyUnsel
		for i = 0, math.floor(math.abs(tPly_count - 1) / 4) do
			local chPly, chID = table.Random(tPlyUnsel) -- 
			table.remove(tPlyUnsel, chID)
//this will add one to the red variable 
	Red = Red + 1;

//this is when a player dies he goes to the yellow team
 function GM:PlayerDeathThink(ply)
	ply:SetTeam( 3 )

what i would like to know is there a way to make it when a player dies if they are on the red team take away 1 from the red variable

In the PlayerDeathThink hook you have a check if they are red team, if so then just add

Red = Red - 1

ok what do you do for the check

Just a suggestion, for the way you do your player count check you could just use either:

table.Count(player.GetAll()) or #player.GetAll()

i only get 0 when i try that
edit: never mind i fixed it