hi i need help please

i need a health script for 3 lives that slowly comes back like after 3 to 6 seconds or somthing like that thank you oh and i use java scripting.
:razz:

Some health script
ALL CODE IS UNTESTED BUT SHOULD WORK

var rechargeTime=3.0;
private var lastRecharge=0.0;
var currentHealth:int=3;
var maxHealth:int=3;


function Update(){//when we update
    if(currentHealth<maxHealth){//if the currentHealth is less then the maxHealth
        if(Time.time>lastRecharge){//we check if it has been as long as the specified time
            lastRecharge=Time.time+rechargeTime;//if so we reset the rechargeTime incase we are more then 1 point less
            currentHealth++;//Then we add 1 point to our health
        }
    } 
}

function GetHit(takeHealth:int){//We call this when we are damaged., specify how much to remove as an int.
    lastRecharge=Time.time+rechargeTime;// we set the recharge time to the current time + how long to wait
    health-=takeHealth;//then we remove the health we specified.
}

This is untested and it IS new years so… yeah It should work! LOL.

-Eddy :slight_smile:

thank you but wen i tryed it it sead scrypt incomplete