Raycast gun problems.

Iv been having some large problems trying to get my gun to use raycast rather then fire an actual bullet. Heres the script. I want the raycast to use the bullets count, and i want it to work. I am getting extremely frustrated. Iv been working at it for days, and i have still no fix for the problem. I also want to keep in mind that this script will be use for a multiplayer game, with networking.

Thanks.

var Bulletspawn : GameObject;
var BulletShellSpawn : GameObject;
var fireRate : float = 0.1;
var ReloadRate : float = 1;
var projectile : Rigidbody;
var BulletShell : Rigidbody;
var bullets = 10;
var MagazineCount = 2;
var speed = 100;
var ShellSpeedy = 100;
var ShellSpeedx = 100;


private var nextFire = 0.0;
private var Reload = 3.5;
function Update () {
    if(MagazineCount>=1)
    {
    if(bullets>=1)
	{
	    if(Input.GetButton("Fire1")&&Time.time > nextFire){
        animation.PlayQueued ("shoot");
        audio.Play ();
        nextFire = Time.time + fireRate;
        var hit : RaycastHit;		
		var direction : Vector3  = transform.TransformDirection(Vector3.forward); 
		Debug.DrawRay(transform.position.BulletSpawn , direction * Range , Color.blue);
		if(Physics.Raycast(BulletSpawn.transform.position , direction , hit, Range)){
		var hitRotation = Quaternion.FromToRotation(Vector3.up, hit.normal);
		if(hit.collider.gameObject.tag == "Untagged"){
		clone = Instantiate(BulletShell,BulletShellSpawn.transform.position, transform.rotation);
		clone.velocity = transform.TransformDirection( Vector3 (ShellSpeedx, ShellSpeedy, 0));
        bullets -= 1;
        Destroy (clone.gameObject, 10);
        }
        if(bullets<=0)
          MagazineCount -= 1;
        }
        else   
        {
           if(Input.GetKey("r")&&Time.time > nextFire){
        animation.PlayQueued ("reload");
        nextFire = Time.time + Reload;
            bullets = 30;
       }
     }
   }
 }
}
function OnGUI()
{
    GUILayout.Label( "       Magazine = " + MagazineCount );
    GUILayout.Label( "       Bullets = " + bullets );
}

Here is the origonal code, this works FANTASTICLY. I just want to replace the projectile thats a bullet, with a raycast.

var ReloadRate : float = 1;
var projectile : Rigidbody;
var BulletShell : Rigidbody;
var bullets = 30;
var MagazineCount = 5;
var speed = 100;
var ShellSpeedy = 3;
var ShellSpeedx = 3;


private var nextFire = 0.0;
private var Reload = 3.5;
function Update () {
    if(MagazineCount>=1)
    {
    if(bullets>=1)
	{
	//If there is an animation, this will check if there is audio, if there is audio this will check the next fire time, if the fire time is right, the script will fire.
	    if(Input.GetButton("Fire1")&&Time.time > nextFire){
        animation.PlayQueued ("shoot");
        audio.Play ();
        nextFire = Time.time + fireRate;
        //Bullet fires on by instantiating the projectile that is a prefab.
        clone = Instantiate(projectile,projectilespawn.transform.position, transform.rotation);
		clone.velocity = transform.TransformDirection( Vector3 (speed, 0, 0));
		//Bullet shell fires by instatiating the bullet shell on the x and y axis.
		clone = Instantiate(BulletShell,BulletShellSpawn.transform.position, transform.rotation);
		clone.velocity = transform.TransformDirection( Vector3 (ShellSpeedx, ShellSpeedy, 0));
        bullets -= 1;
        //Bullets will be destroyed after 10 seconds.
        Destroy (clone.gameObject, 10);
        }
        //If the bullet count reaches zero, the count of magazines will drop by the number that it is set at.
        if(bullets<=0)
          MagazineCount -= 1;
        }
        else   
        //If the magazine count is higher then or is one, the gun will be allowed to reload.
        {
           if(Input.GetKey("r")&&Time.time > nextFire){
        animation.PlayQueued ("reload");
        nextFire = Time.time + Reload;
            bullets = 30;
       }
     }
   }
}
function OnGUI()
//Shows the count of bullets and magazines on the top left of the screen.
{
    GUILayout.Label( "       Magazine = " + MagazineCount );
    GUILayout.Label( "       Bullets = " + bullets );
}