Help with "Kill" script

So I have this script that minuses 10 Health from my main Player. But the problem is he doesn’t die when it reaches 0, and i am having trouble scripting it. Here is the script:

function OnTriggerEnter (col : Collider) {
	var player : FPSPlayer = col.GetComponent(FPSPlayer);
	
	col.GetComponent("HealthScript").health -= 10;
	
	if (player) {
		player.ApplyDamage(10);
		
 }
				
	}
	

function Reset () {
	if (collider == null);	
		gameObject.AddComponent(BoxCollider);
	collider.isTrigger = true;
  }

Ok so from what I could understand, you are calling

function OnTriggerEnter(col:Collider){}

and you are using a completely different function to attempt to “Reset()” something.
The conflict here is that programming doesn’t exactly work the way you might think.
When you have the
(col:Collider)
the parameters aren’t universal, rather private and only shared within that function. So to call the local variable “col” when its not even localized in that function won’t work.
To be a bit more specific. Here is an example.:

You tell a secret to a group of friends that we will call “Group A” and the secret with be called “Secret A”. So if you go over to another group of friends (“Group B”) and ask them about Secret A. They won’t have a single clue about what you are talking about. But if you tell that group the secret then that group will understand.

So the quick fix would be to make the collider variable public within the script and not just local within the function. Since the parameters for your function are required to know them, you can define a variable outside the function and set the variable to the collider inside the function. Example:
var collider;

function OnTriggerEnter(col: Collider){
 collider = col;
}

Hope I helped.

You should place the death checking code inside ApplyDamage, in the FPSPlayer. You’re also applying the damage to different variables located in FPSPlayer and HealthScript - don’t do that! The ideal approach would be to read the FPSPlayer health variable in HealthScript, instead of having two variables - but in order to not modify your scripts too much, you could simply update the HealthScript health variable in Update, in the FPSPlayer - but remember to remove the duplicated damage code from OnTriggerEnter!

All in all, the OnTriggerEnter code would be like this:

function OnTriggerEnter (col : Collider) {
  var player : FPSPlayer = col.GetComponent(FPSPlayer);
  if (player) {
    player.ApplyDamage(10);
  }
}

I don’t know how your FPSPlayer script is implemented, but suppose that it has a health variable, and that the function ApplyDamage just subtracts the damage from it. If it’s true, the FPSPlayer script should become something like this:

var health: float;
private var hScript: HealthScript;

function Start(){
  hScript = GetComponent(HealthScript); // get a reference to HealthScript
}

function ApplyDamage(damage: float){
  health -= damage; // apply the damage...
  if (health <= 0){ // and check if player has died
    // player is dead - place your death code here
  }
}

function Update(){
  // update HealthScript.health every frame:
  hScript.health = health;
}

NOTE: Take the code above as a suggestion! You must adapt it to your actual FPSPlayer code. If you can’t do that, post the script in your question.