HELP decrecing a value over time??

i have a script (below) and i have been trying for ages to put in a function which makes the “fuel” decrease over time. does any one have a clue how or an example of how i can do this.

var score = 0;

function OnTriggerEnter( other : Collider ) { 
    Debug.Log("OnTriggerEnter() was called");
    if (other.tag == "fuel") 
    {
        Debug.Log("Other object is fuel");
        score += 5;
        Debug.Log("Score is now " + score);
        Destroy(other.gameObject);
    }
        
}

function OnGUI() 
{

		GUILayout.BeginArea (Rect (Screen.width/100, Screen.height/100, 100, 750));
		GUILayout.Label( "fuel = " + score );
		
}

cheers

jordan

Assuming score(fuel?) is not 0

function update(){
  if (score > 0) {
    score -= (int)Time.deltaTime * 2;
  } else if (score <=0) {
    // some game over junk... load game over level..
  }
}

never mind guys problem solved

var score = 100.0;
 
function Update()
{
    score -= Time.deltaTime * 0.025;
}
 
function OnTriggerEnter( other : Collider )
{
    Debug.Log("OnTriggerEnter() was called");
 
    if (other.tag == "fuel")
    {
        Debug.Log("Other object is a coin");
        score += 5.0;
        Debug.Log("Score is now " + score);
        Destroy(other.gameObject);
    }
}
 
function OnGUI()
{
    GUILayout.BeginArea (Rect (Screen.width/100, Screen.height/100, 100, 750));
    GUILayout.Label( "fuel = " + Mathf.FloorToInt(score));
}