Camera Lerping not working

hero : Transform;
static var cameraY : boolean = false;

function Update()
{
     if(cameraY == true)
     {
        transform.position.y = Vector3.Lerp(transform.position.y, hero.position.y, Time.deltaTime);
     }   
}

I get an message of lerp wont work with (float,float,float). I switched lerp to move towards and it gave me the same float problem.

You have to use Mathf.lerp

    transform.position.y = Mathf.Lerp(transform.position.y, hero.position.y, Time.deltaTime);

Vector3.Lerp takes Vector3s, not floats.

Vector3.Lerp Script Reference