damage health script ineffective, no noticable mistakes

im making yet another slenderman indie, and i am trying to make it so that when slenderman comes in contact with the first person controller it kills him and resets the location, esentially restarting the game. i have my stalking script down but my damage system seems to be ineffective. i have looked at it several times. it is such a simple script yet it remains ineffective. my first person controller contains the rigidbody component while my enemy contains a mesh collider.

  1. var health : int = 100;

private var dead : boolean = false;

var enemyDamage : int = -100;

function OnControllerColliderHit(hit : ControllerColliderHit)
{

if(hit.gameObject.tag == "BloodBoss")
{
health +=enemyDamage;
} 

}

function Update () {

if(health <= 0)
{ 
dead = true;
}

if(dead == true)
{

transform.position = Vector3(0,0,0);

}

}

your adding more health everytime you get hit.
you need to do this instead

  if(hit.gameObject.tag == "BloodBoss")
    {
    health -=enemyDamage;
    }

try adding this script to your players FPS script just after the variables: :
private var dead = false;

function OnTriggerEnter(hit : Collider)

{

if(hit.gameObject.tag=="BloodBoss")

{
	
	dead = true;
    }

and add this to the end of the script:
function LateUpdate()

{

if(dead)

{

transform.position = Vector3(0,0,0);

also remember to make a tag called BloodBoss and add it to your slendeman :slight_smile: