Score Scripting Help

How would I go about scripting the scoring in a way that if Team 1 kills all of Team 2 they win but if time runs out and Team 2 has people who are still alive Team 2 wins? o:

I got some help from someone but some things aren’t working and i don’t know how to fix it.

If team 2 is still alive by the end of the timer it keeps going to Draw instead of a victory, and if Team 1 kills all of Team 2 it says Defeat even tho they are doing the Victory pose. OTL

Mareaucanard -  they also left me a code 9QW23

rule("When the game start, set T=[Duration of the game in secs]")
    {
    	event
    	{
    		Ongoing - Global;
    	}

    	conditions
    	{
    		Is Game In Progress == True;
    	}

    	actions
    	{
    		Set Global Variable(T, 120);
    	}
    }

    rule("Every second, subtrac one from T")
    {
    	event
    	{
    		Ongoing - Global;
    	}

    	conditions
    	{
    		Is Game In Progress == True;
    	}

    	actions
    	{
    		Wait(1, Ignore Condition);
    		Modify Global Variable(T, Subtract, 1);
    		Loop If(Compare(Global Variable(T), >, 0));
    		Declare Team Victory(Team 2);
    	}
    }

    rule("Declare team 1 victory if team 2 is dead and time as not run out")
    {
    	event
    	{
    		Ongoing - Global;
    	}

    	conditions
    	{
    		Number of Dead Players(Team 2) == Number of Players(Team 2);
    		Global Variable(T) > 0;
    		Is Game In Progress == True;
    	}

    	actions
    	{
    		Declare Team Victory(Team 1);
    	}
    }`Preformatted text`