How can I make this only act once?

I made a script that gets when a certain variable = true, it subtracts 300 from another variable. The only problem is that it keeps subtracting and never stops. How can I make it only subtract once when it finds that it equals false? Thanks.

var LimbBroke : boolean = false;
var BodyArmature : GameObject;
var BodyMesh : GameObject;
var Blood : GameObject;
var SystemHealth : GameObject;

function Start ()
{
    Blood.particleEmitter.enabled = false;
}

function Update ()
{
    if(BodyArmature.GetComponent(LimbHealth).Health == 0)
    {
        LimbBroke = true;
        BodyMesh.renderer.enabled = false;
        Blood.particleEmitter.enabled = true;
        SystemHealth.GetComponent(MainPlayerHealth).MaxHealth -= 300;
    }
    
    if(BodyArmature.GetComponent(LimbHealth).Health == 100)
    {
        LimbBroke = false;
        BodyMesh.renderer.enabled = true; 
    }
}

replace

if(BodyArmature.GetComponent(LimbHealth).Health == 0)

with

if(BodyArmature.GetComponent(LimbHealth).Health == 0 && !LimbBroke)

or declare other variable and set it to another value on first executing, and don’t execute again if variable in new state

Change your if statement on the first one to this: it should work.

if(BodyArmature.GetComponent(LimbHealth).Health == 0 && LimbBroke == false)

Do you really have to check the health every frame?

Why not have an applyDmg(float dmgValue) function.

Like this

var LimbBroke : boolean = false;
var BodyArmature : GameObject;
var BodyMesh : GameObject;
var Blood : GameObject;
var SystemHealth : GameObject;

function Start ()
{
    LimbBroke = false;
    BodyMesh.renderer.enabled = true; 
    Blood.particleEmitter.enabled = false;
}

function Update ()
{
}

public function applyDmg(healValue : float)
{
var health : float = BodyArmature.GetComponent(LimbHealth).Health;
if(health > 0.0f)
{
    health -= dmgValue;
    if(health <= 0.0f)
    {
        LimbBroke = true;
        BodyMesh.renderer.enabled = false;
        Blood.particleEmitter.enabled = true;
        SystemHealth.GetComponent(MainPlayerHealth).MaxHealth -= 300;
        BodyArmature.GetComponent(LimbHealth).Health = 0.0f;
    }
    else
    {
        BodyArmature.GetComponent(LimbHealth).Health = health;
    }
}

}

function applyHealing(healValue : float)
{
var health : float= BodyArmature.GetComponent(LimbHealth).Health;
if(health < 100.0f)
{
    health += healValue;
    if(LimbBroke == true && health >= 100.0f)
    {
        LimbBroke = false;
        BodyMesh.renderer.enabled = true;
        BodyArmature.GetComponent(LimbHealth).Health = 100.0f;
    }
    else
    {
        BodyArmature.GetComponent(LimbHealth).Health = health;
    }
}