Raycast shooting

I have a weapon firing using raycast, when i click the mouse it fires, but the muzzle flash only appears when im pointing it at a target.

any suggestions as to why this happens?

the shoot section of the code

void Shoot()
{
	RaycastHit hit;
	if (Physics.Raycast (fpsCam.transform.position, fpsCam.transform.forward, out hit, range)) 
	{
		Debug.Log (hit.transform.name);

		Instantiate (flash, flashSpawn.position, flashSpawn.rotation); //addition

		Target target = hit.transform.GetComponent<Target>();
		if (target != null)
		{
			target.TakeDamage(damage);
		}
	}
}

}

When using a Raycast in an if statement it only evaluates to true if the Raycast has hit something. You need to add the muzzle flash outside the if statement because it is only executed when the Raycast is hitting a collider, not when the Raycast is fired. This script should work for you, I have just moved your flash instantiate outside the if statement:

void Shoot()
 {
     Instantiate (flash, flashSpawn.position, flashSpawn.rotation);
     RaycastHit hit;
     if (Physics.Raycast (fpsCam.transform.position, fpsCam.transform.forward, out hit, range)) 
     {
         Debug.Log (hit.transform.name);
         Target target = hit.transform.GetComponent<Target>();
         if (target != null)
         {
             target.TakeDamage(damage);
         }
     }
 }