clamp limit variables trouble

he guys,

im having trouble limiting my zoom. i have this code so far

the code for scaling

if (GUI.RepeatButton(pos5, "zoom in"))
  {
    transform.localScale.x += 0.0007; // maak het object bigger
    transform.localScale.y += 0.0007;
    transform.localScale.z += 0.0007; 
  }

  if (GUI.RepeatButton(pos6, "zoom out")) // maak het object smaller
    {
    transform.localScale.x -= 0.0007;
    transform.localScale.y -= 0.0007;
    transform.localScale.z -= 0.0007;

code for limiting

function Update (){
    transform.localScale.x = Mathf.Clamp(Time.time, 0, 0.5);
    transform.localScale.y = Mathf.Clamp(Time.time, 0, 0.5);
    transform.localScale.z = Mathf.Clamp(Time.time, 0, 0.5);

}

i think im missing a float variable or something. cuz now the object gets scaled to the 0.5 and its not a limit somehow.

im still scratching ,my head with this :(

could someone help me?

If you use Time.time as value as soon as Time.time is > 0.5 your value will always be 0.5. That's probably not what you want. The correct approach would be to use the scale value as instead of Time.time:

function Update() {
  transform.localScale.x = Mathf.Clamp(transform.localScale.x, 0, 0.5);
}