Slowly diminishing healthbar + objects that add to the healthbar.

Alright, Hello guys.
I am trying to get my health bar to gradually decrease over time.
I have got it so that when you click the mouse the health goes down, but how do I make it go down by itself?
I’d also like to know how to go about a script to attach to a ‘medkit’ type object so that it adds say, 10hp back onto the health bar?
So at the moment I am using a guitexture for the bar.
Below is the code that makes it diminish with the mouseclick.

var maximumHitPoints = 10.0;
var hitPoints = 10.0;
var healthGUI : GUITexture;
var die : AudioClip;
var buttonDown : boolean = false;
//var resetPoints : float = 0.0;
var damage : float = 0.0;

private var healthGUIWidth = 0.0;

function Awake () {
    healthGUIWidth = healthGUI.pixelInset.width;
}

function Update() {
    if (Input.GetButton("Fire1"))
    {
        damage = Time.deltaTime;
        ApplyDamage();
    }
}

function LateUpdate () {
    UpdateGUI();
}

function ApplyDamage () {
    hitPoints -= damage;
    if (hitPoints < 0.0)
        Die();

}

function Die () {
    if (die)
        AudioSource.PlayClipAtPoint(die, transform.position);
}

function UpdateGUI () {

    var healthFraction = Mathf.Clamp01(hitPoints / maximumHitPoints);
    healthGUI.pixelInset.xMax = healthGUI.pixelInset.xMin + healthGUIWidth * healthFraction;

}

Well, if you just remove all the 'if(Input.Whatever)' bits from Update, it'll decrease health on its own (since you are no longer checking for whether the player is clicking or not). As for the medikit, just have something like this in your Update-

if(Input.GetButtonDown("Heal"))
{
    hitPoints += 10;
}

Or, however you want to do it.

If you need a 'pickup' for health, do this-

function OnTriggerEnter(other : Collider)
{
    if(other.gameObject.tag == "HealthPickup")
    {
        hitPoints += 10;
        Destroy(other.gameObject);
    }
}

You could set that up so that each individual pickup has its own health value, and when you touch it it heals you for that amount.

Thank’s so much syclamoth, works exactly how I wanted. With the medkit code you posted, that only increases the hitpoints if your pressing a button?
I have an object in game which acts as a medkit and should increase the healthbar when a collision is detected.