Raycast shooting

Hello everyone i have a raycast script here for a gun but it only makes the ray thing in the center of the screen, i want it so tha the ray will come out the barrel of my gun, could anyone help me?..

Here is my script:

var Effect : Transform;
var TheDamage = 100;
var sound : AudioClip;

function Update () {
   if(Input.GetButtonDown("Fire1")){ 
     audio.PlayOneShot(sound);
     audio.Play();
   }

   var hit : RaycastHit;
   var ray : Ray = Camera.main.ScreenPointToRay(Vector3(Screen.width*0.5, Screen.height*0.5, 0));
   if (Input.GetMouseButtonDown(0)){
       if (Physics.Raycast (ray, hit, 100)) 
       {
           var particleClone = Instantiate(Effect, hit.point, Quaternion.LookRotation(hit.normal));
           Destroy(particleClone.gameObject, 2);
           hit.transform.SendMessage("ApplyDamage", TheDamage, SendMessageOptions.DontRequireReceiver);
       }
   }
}

You would change the starting of the raycast from a point at the end of the barrel and orientate the beam to align with the ray you have been using.

Maybe something like this:

var endBarrel :Transform;

function Update(){
      var hit : RaycastHit;
      var ray : Ray = Camera.main.ScreenPointToRay(Vector3(Screen.width*0.5, Screen.height*0.5, 0));
      if (Input.GetMouseButtonDown(0)){
          if (Physics.Raycast (endBarrel,ray.direction hit, 100))
          {

          }
      }
   }

Maybe like this.

Get rid of this line:

var ray : Ray = Camera.main.ScreenPointToRay(Vector3(Screen.width*0.5, Screen.height*0.5, 0));

And then this line:

Physics.Raycast (ray, hit, 100)

Needs to be:

Physics.Raycast (transform.position, transform.forward, 100)

Granted, this will start your ray in the middle of the gun, so you may need to change the position a little