Aiming script not working properly

I have no idea why, but the gun goes to the other side of the map
Here is the code:

    //variables
    var gun : Transform;
    var aimSpeed : float = 5.0;
    var normalPos : Vector3;
    var aimPos : Vector3;
    
    //under function update
    
    if(Input.GetButtonDown("Fire2")){
    gun.transform.position = Vector3.Lerp (transform.position, aimPos, Time.deltaTime * aimSpeed);
    }
    else
    {
    gun.transform.position = Vector3.Lerp (transform.position, normalPos, Time.deltaTime * aimSpeed);
    	}

Anything wrong?

(The script is not separate, it is inside another shooting script)

Input.GetButtonDown() is only true for the single frame the buttons goes down. So your Lerp() to aimPos will only execute for a single frame. I’m not sure of your desired behavior. If you only want movement when the button is down, then you can change the GetButtonDown() to GetButton(). But if you want the gun to move independently (i.e. the user clicks on the “Fire2” button), then you will need to set a boolean value when they hit the “Fire2” button, and use that boolean when you Lerp().