How to make an object and a value to a variable

in this case a health pack, my main player has the variable var hitPoints = 100.0 and when an object takes the health down what script would i use to bring them back up?

Your player controller code could contain something like this:

var hitPoints : float = 100.0;

function ApplyDamage(dmg : float) {
    hitPoints = Mathf.Max(0.0, hitPoints - dmg);
    if (hitPoints <= 0.0) {
        // handle dying...
    }
}

function Heal(points : float) {
    hitPoints = Mathf.Min(100.0, hitPoints + points);
}

// rest of player controller code...

Make a health package have a collider with isTrigger checked and a script like:

function OnTriggerEnter(other : Collider) {
    if (other.gameObject.tag == "Player") {
        // tell player to heal
        other.gameObject.SendMessage("Heal", 10.0, SendMessageOptions.DontRequireReceiver);
        // destroy health package
        GameObject.Destroy(gameObject);
    }
}

About the same script can be used for objects applying damage (bullets, traps, ...) only `Heal` should be replaced with `ApplyDamage`.