Continue Movement of camera

hey, i want to continue the movement of the camera until it has reached it target here is my code:

var transitionDuration : float = 2.5f;
var target : Transform;
var timer : int = 0;

var transitionDuration : float = 2.5f;

var target : Transform;
var timer : int = 0;

function Update()
{
if(Input.GetKey(“Fire1”))
{

	Transition();
	
}

}
function Transition()
{
var t : float = 0.0f;
var startingPos : Vector3 = transform.position;
while (t < 1.0f)
{
t += Time.deltaTime * (Time.timeScale/transitionDuration);

    transform.position = Vector3.Lerp(startingPos, target.position, t);
    Debug.Log(transitionDuration);
    return 0;
}

}

It’s a good start, but you need to use the keyword yield, not return. “yield null;” to be accurate. This will pause the execution of the loop until the next frame.