help with exp bar

i have this exp bar it it attached to a gui texture. it workes fine until the player levels up because the maxexp changes . can anyone show me how i can make the maxexp into the guis 100%

so what ever maxexp is it is 100%

function Update ()

{ var number = Pointslevels.exp; var posx= transform.position.x; var posy= transform.position.y; guiTexture.pixelInset = Rect (posx, posy, number, 9);

}

this is attached to the gui

static var level:float = 0;

static var exp:float = 0; static var maxexp:float = 50; static var expde:float = 0;

function Update () { if(exp>=maxexp){

    level +=1;
    expde +=10;
    maxexp +=10;
    exp =0;
//exp =0;

}

}

this is like other stuff that has the maxexp and the current exp

If I understand it right, here is what you should do :

var expWidth = 100;

function Update()
{
   var number : float = (Pointslevel.exp+0.0f) / Pointslevel.maxexp; // Need to cast first operande from int to float.
[...]
   guiTexture.pixelInset = Rect (posx, posy, number * expWidth, 9);
}

your guiTexture width will be between 0 and 1 relatively to your progression, then rescaled by expWidth.