Sound not playing correctly And projectiles not firing Correctly...

So I started a FPS game a few days ago, and I just can’t figure out a few bugs I have. My first problem is when I fire the gun the sound will play correctly, but if I fire again before the first sound finishes it will cut off the first sound clip and start over. Is there a way where I can get the sound to play over top of one another so that they can finish playing the entire sound clip? Here’s what my code looks like;
var projectile:Rigidbody;
var Play:AudioClip;

function Update ()
{
	//Simple Bullet Physics
	if (Input.GetButtonDown ("Fire1")) 
	{
	
		//Instantiate the projectile at the position and rotation of this transform
		var clone : Rigidbody;
		clone = Instantiate(projectile, transform.position, transform.rotation);
		
		//Give the cloned obbject an initial velocity along the current
		//Object's Z axis
		clone.velocity = transform.TransformDirection (Vector3.forward * 50);	
		
		//Heres where the sound Comes in
		audio.Play();
		
	}	

}

My second problem is when I’m looking at certain angles, and I fire the projectile will sometimes fly off in very strange directions. I’m thinking it’s something to do with the code too, but if not does anyone know what the problem is?
Thanks for taking time to read this and helping out.

:slight_smile:

To play sounds on top of one another, I think you’ll need an audiosource for each. You should Instantiate a gameobject with that audiosource end the right clip each time you shoot (make sure to delete them when they stopped playing, and don’t forget that Destroy has a time parameter).

For the second part, from the doc : “Transforms direction from local space to world space”. So change that line for :

   clone.velocity = transform.forward * 50;