Make this script work more smoothly?

I have a script that changes the variable ‘yOffset’ in my code ‘MouseOrbitOTS’ from 0.0 to 0.2 when you hold the ‘Aim’ input. Here’s that script…

var NormalY: float = 0.8; // XOffset while not aiming
var AimY: float = 0.7; // XOffset while aiming
private var cameraScript: MouseOrbitOTS;
function Start(){
     cameraScript = GetComponent(MouseOrbitOTS);
     var ch:Camera = GetComponent(Camera);
}
function Update(){
     var cameraY = NormalY;
     if (Input.GetButton("Aim")){
         cameraY = AimY;
      }
      cameraScript.yOffset = cameraY; // set XOffset while aiming or not aiming
}

What do you mean more smoothly? If you talking about the camera moving, maybe take a look at Lerp or functions or even using a Sin based lerp to ease in and out of the movement.

You could maybe put that code into a LateUpdate function too.