Why won't my audio work? Help!

My gunshot sound only plays when I first start the game, instead of everytime I press the mouse button. What am I doing wrong?

var clip : AudioClip;

function Update ()
{
if(Input.GetButtonDown(“Fire1”))
GetComponent.().Play(“Recoil”, 0);
GetComponent.().PlayOneShot(clip);

}

Well there seems to be a if-scope problem. I don’t think you want it to play each Update(). Remember to place accolades. Now it tries to play it each frame, and with some silence at the beginning, you’ll hear nothing at all. The first blast is PROBABLY the Project view preview of the wav.

#1 - Please use code tags
http://forum.unity3d.com/threads/using-code-tags-properly.143875/
#2 - Jordii is correct, it is playing the audio every single frame, because you didn’t use brackets with the IF statement, so the IF statement only filters the line playing the animation (the statement directly underneath it), because that’s how an IF statement without brackets works.

function Update ()
{
if(Input.GetButtonDown("Fire1"))
{
GetComponent.<Animation>().Play("Recoil", 0);
GetComponent.<AudioSource>().PlayOneShot(clip);
}
}

#3 - You shouldn’t be using GetComponent every time you need to access these components, you should be getting the components once and caching the results
http://docs.unity3d.com/412/Documentation/ScriptReference/index.Performance_Optimization.html

thankyou so much!! Script worked perfectly