Weapon rotating in a weird way?

Hello, i have a survival game where i have an axe. I added some realism to the axe by giving it a realistic movment script. (moves it when i move my mouse). But when i run the gem, it just rotates to the side. I position it right in the scene, but when i enter playmode it rotates 90 degrees. The model is made in blender and here is the script (not mine):

#pragma strict

 var amount : float = 0.02;
 var maxAmount : float = 0.03;
 var Smooth : float = 3;
 var SmoothRotation = 2;
 var tiltAngle = 25;
  
 private var def : Vector3;
  
 function Start ()
 {
     def = transform.localPosition;
 }
  
 function Update ()
 {
         var factorX : float = -Input.GetAxis("Mouse X") * amount;
         var factorY : float = -Input.GetAxis("Mouse Y") * amount;
        
         if (factorX > maxAmount)
             factorX = maxAmount;
        
         if (factorX < -maxAmount)
                 factorX = -maxAmount;
  
         if (factorY > maxAmount)
                 factorY = maxAmount;
        
         if (factorY < -maxAmount)
                 factorY = -maxAmount;
                
  
         var Final : Vector3 = new Vector3(def.x+factorX, def.y+factorY, def.z);
         transform.localPosition = Vector3.Lerp(transform.localPosition, Final, Time.deltaTime * Smooth);
        
              
         var tiltAroundZ = Input.GetAxis("Mouse X") * tiltAngle;
         var tiltAroundX = Input.GetAxis("Mouse Y") * tiltAngle;
         var target = Quaternion.Euler (tiltAroundX, 0, tiltAroundZ);
         transform.localRotation = Quaternion.Slerp(transform.localRotation, target,Time.deltaTime * SmoothRotation);    
 }

You are starting with transform.localRotation as whatever is set in the scene, then immediately lerping to tiltAroundX and tiltAroundZ of 0, assuming zeroes from the GetAxis. Verify by commenting out this line and see if it does not rotate:

transform.localRotation = Quaternion.Slerp(transform.localRotation, target,Time.deltaTime * SmoothRotation);

Also, I think those position and rotation lerps are not implemented correctly. Each frame, you are setting the position and rotation as the output of the lerp. Then next frame you are using the that updated value as the starting point for the lerp. You need to cache the start position and rotation at the beginning of the lerp, and blend between the start and target. The current implementation is changing the “start” each update.