Ran into some trouble. The sound wont cut iff when i release the trigger.
Datablock
datablock AudioProfile(M4Fire)
{
   filename    = "./Sounds/M4Fire.wav";
   description = AudioDefaultLooping3d;
   preload = true;
};
State Sequence
stateName[0]                    = "Activate";
	stateTimeoutValue[0]            = 0.15;
	stateTransitionOnTimeout[0]     = "LoadCheckA";
	stateName[1]                    = "Ready";
	stateTransitionOnNoAmmo[1]	= "ReloadStart";
	stateTransitionOnTriggerDown[1] = "Fire";
	stateAllowImageChange[1]        = true;
	stateSequence[1] = "idle";
	stateName[2]                    = "Fire";
	stateTransitionOnTimeout[2]     = "Smoke";
	stateTransitionOnTriggerUp[2] = "Smoke";
	stateWaitForTimeout[2]		= true;
	stateTimeoutValue[2]            = 0.00;
	stateFire[2]                    = true;
	stateAllowImageChange[2]        = false;
	stateScript[2]                  = "onFire";
	stateSequence[2]		= "Fire";
	stateEmitter[2]			= testmuzzleFireEmitter;
	stateEmitterTime[2]		= 0.01;
	stateEmitterNode[2]		= "muzzleNode";
	stateSound[2]			= M4Fire;
	stateName[3] 			= "Smoke";
	stateTimeoutValue[3]		= 0.035;
	stateEmitter[3]			= testSmokeEmitter;
	stateEmitterTime[3]		= 0.04;
	stateEmitterNode[3]		= "muzzleNode";
	stateTransitionOnTimeout[3]	= "Wait";
	//	stateTransitionOnTriggerDown[3] = "Wait";  remove timeout and triggerdown for semiauto
	stateName[4]			= "Wait";
	stateEjectShell[2]              = true;
	stateTimeoutValue[4]		= 0.002;
	stateScript[4]                  = "onBounce";
	stateTransitionOnTimeout[4]	= "LoadCheckA";
	
	//Torque switches states instantly if there is an ammo/noammo state, regardless of stateWaitForTimeout
	stateName[5]				= "LoadCheckA";
	stateScript[5]				= "onLoadCheck";
	stateTimeoutValue[5]			= 0.00;
	stateTransitionOnTimeout[5]		= "LoadCheckB";
	
	stateName[6]				= "LoadCheckB";
	stateTransitionOnAmmo[6]		= "Ready";
	stateTransitionOnNoAmmo[6]		= "ReloadWait";
	
	stateName[7]				= "ReloadWait";
	stateTimeoutValue[7]			= 0.3;
	stateScript[7]				= "";
	stateTransitionOnTimeout[7]		= "ReloadStart";
	stateWaitForTimeout[7]			= true;
	
	stateName[8]				= "ReloadStart";
	stateTimeoutValue[8]			= 1.0;
	stateScript[8]				= "onReloadStart";
	stateTransitionOnTimeout[8]		= "Reloaded";
	stateWaitForTimeout[8]			= true;
	
	stateName[9]				= "Reloaded";
	stateTimeoutValue[9]			= 0.0;
	stateScript[9]				= "onReloaded";
	stateTransitionOnTimeout[9]		= "Ready";
	
	stateName[10] = "StopFire";
	stateScript[10]                  = "onStopFire";
	stateTimeoutValue[10]            = 0.5;
	stateTransitionOnTimeout[10]     = "Smoke";
};
Functions
function M4A1Image::onFire(%this,%obj,%slot)
{
	%obj.playAudio(0, M4Fire);
	
	%obj.spawnExplosion(SmallAutoRecoilProjectile,"1 1 1");
	if(%obj.getDamagePercent() >= 1.0)
		return;
		
	if(vectorLen(%obj.getVelocity()) < 0.1 && (getSimTime() - %obj.lastShotTime) > 50)
	{
		%projectile = M4A1Projectile;
		%spread = 0.007;
	}
	else
	{
		%projectile = M4A1Projectile;
		%spread = 0.007;
	}
	
	%obj.lastShotTime = getSimTime();
	%shellcount = 1;
	%obj.playThread(2, Root);
	%shellcount = 1;
	%obj.toolAmmo[%obj.currTool]--;
	commandToClient(%obj.client,'bottomPrint',"<color:0aa000><just:right><font:Arial:20>\c6" @ %obj.toolAmmo[%obj.currTool] @ " / " @ "31 " @ "", 4, 2, 3, 4); 
	for(%shell=0; %shell<%shellcount; %shell++)
	{
		%vector = %obj.getMuzzleVector(%slot);
		%objectVelocity = %obj.getVelocity();
		%vector1 = VectorScale(%vector, %projectile.muzzleVelocity);
		%vector2 = VectorScale(%objectVelocity, %projectile.velInheritFactor);
		%velocity = VectorAdd(%vector1,%vector2);
		%x = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
		%y = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
		%z = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
		%mat = MatrixCreateFromEuler(%x @ " " @ %y @ " " @ %z);
		%velocity = MatrixMulVector(%mat, %velocity);
		%p = new (%this.projectileType)()
		{
			dataBlock = %projectile;
			initialVelocity = %velocity;
			initialPosition = %obj.getMuzzlePoint(%slot);
			sourceObject = %obj;
			sourceSlot = %slot;
			client = %obj.client;
		};
		MissionCleanup.add(%p);
	}
	return %p;
	Parent::onFire(%this,%obj,%slot);
}
function M4A1Image::onStopFire(%this, %obj, %slot)
{
	%obj.stopAudio(0);
}