Damage taking?

This is my code for a health bar script, yet I am unsure of how to make my health/health bar size decrease accordingly;

@script ExecuteInEditMode()
var healthTexture : Texture2D;
var healthBorder : Texture2D;
var health : int = 100;

function OnGUI () {

GUI.DrawTexture(Rect(43,Screen.height - 65,314,36), healthBorder);

var adjust : int = health * 3; //adjusting texture size (width) / health(100)
GUI.BeginGroup(Rect(55,Screen.height - 55,adjust,15));
GUI.DrawTexture(Rect(0,0,290,15), healthTexture);
GUI.EndGroup();
}

In the awake you set

var health = 100;
var currHealth = 100;
var maxHealth = 100;

In the update you set the health

health = currHealth/maxHealth

In the on GUI

Put in your code BUT replace

GUI.DrawTexture(Rect(0,0,290,15), healthTexture);

And

var adjust : int = health * 3

With

GUI.DrawTexture(Rect(0,0,health,15), healthTexture);

And
var adjust : int = currHealth * 3

Im pretty sure that will work
~Myhijim