The while(lvl > 0) loop has no wait(1) instruction inside, so maybe thats the reason?
Updated the
Code:
//impostare i flag
action level 
{
	my.transparent = ON;
	my.alpha = 0;
	my.ambient = 35;
	gameover_pan.alpha = 0;
	wait(-5);
	
	while(lvl > 0)
	{
		while(lvl == 1)
		{
			my.alpha -= my.flag2*4*time_step;
			my.x = player.x;
			my.z = player.z;
			my.y = player.y;
			if(my.alpha < 100)
			{
				my.alpha += my.flag1*2*time_step;
				my.alpha -= my.flag2*2*time_step;
			}
			my.pan += 10*my.flag1;
			wait(1);
		}
		
		while(lvl == 2)
		{
			my.x = player.x;
			my.z = player.z;
			my.y = player.y;
			if(my.alpha < 100)
			{
				my.alpha += my.flag2*2*time_step;
			}
			my.roll += 3*my.flag2;
			wait(1);
		}
		
		wait(1);
	}
	
	while(my.alpha > 0)
	{
		my.alpha-= 2*time_step;
		wait(1);
	}
	
	gameover_pan.visible = on; //parte del gameover
	
	while(gameover_pan.alpha <= 100)
	{
		gameover_pan.alpha += 10 * time_step;
		wait(1);
	}
}