Recoil Script Disfunctioning

Hello, i found an old recoil script from 2009, i have a problem tho. When ever i start my game my weapon turns 90 degrees to the left and stays like that. I’ve tried to change it but doesn’t seem to work.
Any help is welcome (:

#pragma strict

var recoilMod : Transform;
var weapon : GameObject;
var maxRecoil_x : float = -20;
var recoilSpeed : float = 10;
var recoil : float = 0.0;
 
function Update()
{
    if(Input.GetMouseButton(0))
    {
        //every time you fire a bullet, add to the recoil.. of course you can probably set a max recoil etc..
        recoil+= 0.25;
    }
 
    recoiling();
}
 
function recoiling()
{
    if(recoil > 0)
    {
        var maxRecoil = Quaternion.Euler (maxRecoil_x, 0, 0);
        // Dampen towards the target rotation
        recoilMod.rotation = Quaternion.Slerp(recoilMod.rotation, maxRecoil, Time.deltaTime * recoilSpeed);
        weapon.transform.localEulerAngles.x = recoilMod.localEulerAngles.x;
        recoil -= Time.deltaTime;
    }
    else
    {
        recoil = 0;
        var minRecoil = Quaternion.Euler (0, 0, 0);
        // Dampen towards the target rotation
        recoilMod.rotation = Quaternion.Slerp(recoilMod.rotation, minRecoil,Time.deltaTime * recoilSpeed / 2);
        weapon.transform.localEulerAngles.x = recoilMod.localEulerAngles.x;
    }
}

Use This

var recoilMod : Transform;
 var weapon : GameObject;
 var maxRecoil_x : float = -20;
 var recoilSpeed : float = 10;
 var recoil : float = 0.0;
  
 function Update()
 {
     if(Input.GetMouseButton(0))
     {
         //every time you fire a bullet, add to the recoil.. of course you can probably set a max recoil etc..
         recoil+= 0.25;
     }else
     {
     recoil = 0;
     }
  
     recoiling();
 }
  
 function recoiling()
 {
     if(recoil > 0)
     {
         var maxRecoil = Quaternion.Euler (maxRecoil_x, 0, 0);
         // Dampen towards the target rotation
         recoilMod.rotation = Quaternion.Slerp(recoilMod.rotation, maxRecoil, Time.deltaTime * recoilSpeed);
         weapon.transform.localEulerAngles.x = recoilMod.localEulerAngles.x;
         recoil -= Time.deltaTime;
     }
     else
     {
         recoil = 0;
         var minRecoil = Quaternion.Euler (0, 0, 0);
         // Dampen towards the target rotation
         recoilMod.rotation = Quaternion.Slerp(recoilMod.rotation, minRecoil,Time.deltaTime * recoilSpeed / 2);
         weapon.transform.localEulerAngles.x = recoilMod.localEulerAngles.x;
     }
 }