Need help with Enabling/Disabling GUITextures with script

My script is for a flash light, the idea is that when the variable energy goes below 50 the GUI of a green battery disappears. The issue I am having is that my script doesn’t work with the drainspeed variable, the GUI doesn’t disappear when it’s drained below 50, however i wonder if this is an issue with the function only being read once…

var lightSource : Light; //Connect the light source in the Inspector
var bat1 : GUITexture;
static var energy : float = 60; //The energy amount of the flashlight
static var turnedOn : boolean = false; //Boolean to check whether it's turned on or off
private var drainSpeed : float = 10.0; //The speed that the energy is drained
 
function Update () {
    if (Input.GetKeyDown(KeyCode.E)) ToggleFlashlight();
}
 
//When the player press F we toggle the flashlight on and off
function ToggleFlashlight () {
    turnedOn=!turnedOn;
    if (turnedOn && energy>0) {
       TurnOnAndDrainEnergy();
    } else {
       lightSource.enabled = false;
    }
}
 
//When the flashlight is turned on we enter a while loop which drains the energy
function TurnOnAndDrainEnergy () {
    lightSource.enabled = true;
    while (turnedOn && energy>0) {
       energy -= drainSpeed*Time.deltaTime;
       yield;
    }
    lightSource.enabled = false;
}
 
//This is called from outside the script to alter the amount of energy
static function AlterEnergy (amount : int) {
    energy = Mathf.Clamp(energy+amount, 0, 100);
}

function Start(){

if(energy > 50){
bat1.enabled = true;
}
if(energy <50){
bat1.enabled = false;
}}

and this is my script

You should call enabled and set it to false.
Instead of calling disabled.

The disabled property doesn’t exist on any type of object.