How to unityscript, if GetButton wait some time?

The intent is to loop if button is down, to keep looping, but wait time before carrying out the rest of the function. Tried yeild wait for seconds, but doesnt work because update cannot be used as coroutine.

if (GetButton("Button")){
      waiting();
}

function waiting (){
yield WaitForSeconds (10.0);

}

Tried using StartCoroutine that yield WaitForTime, but doesnt do anything. The entire coroutine seems to make no difference or gets ignored. You would think it would.

This won’t work… I guess, maybe this could work for you, I didn’t test it.

float buttonDownTime = 0f;

void Update () {
    if (GetButtonDown("Button")){
        buttonDownTime += Time.deltaTime;
        if (buttonDownTime > timeNeed)
             //Do what you want
    }
    else 
        buttonDownTime = 0;
}

if(Input.GetButton(“Button”)){

}

you just need to delete “down” and now it will go through this statement when player hold the button

private var timer : float;
private var holding : false;
function Update () {
if (GetButtonDown(“Button”)){
timer+=Time.deltaTime;
holding=true;
}
if(GetButtonUp(“Button”)){
print(“button was held for “+timer+” seconds”);
timer = 0;
holding=false;
}
if(holding){
//write some code
}
}

i dont full understand what you mean by:
but doesnt help with making it wait some time between.