Turret Bullets hurt me

Hi im using Tornado Twins’ YouTube series on how to make a turret shoot at me using this script:

var LookAtTarget : Transform;
var damp : float = 6.0;
var bullitPrefab : Transform;
var shotTime: float = 0;
var shotInterval: float = 2;
var speed : float = 1000.0;

function Update ()
{
     if(LookAtTarget)
     {
          var rotate = Quaternion.LookRotation(LookAtTarget.position - transform.position); 
          transform.rotation = Quaternion.Slerp(transform.rotation, rotate, Time.deltaTime * damp); 
          if (Time.time > shotTime){ 
              Shoot();
              shotTime = Time.time + shotInterval;
          }
     }
}

function Shoot()
{
     var bullit = Instantiate(bullitPrefab, transform.Find("spawnPoint").transform.position, Quaternion.identity);
     bullit.rigidbody.AddForce(transform.forward * speed);
}

and it works great but i want when the bullet hits me, for it to hurt me, or say if 5 bullets hit me, i respawn. Any idea how to do this? Thanks so much!

Try adding a health script to your player. When the player gets hit you take damage until you reach zero and at that point you will respawn.

var health : float = 100.0;
var damageRate:float = 3;
var startHealth:float;

function Awake()
{
	startHealth = health;
}

function Update () 
{
	if (health < 0) 
	{
		Reset();
	}
}

function OnGUI () {
	GUI.backgroundColor = Color.yellow;
	GUI.Label(Rect(300,10, 150, 30), "Player Health");
    GUI.Box (Rect (300,40,150,30), "" + Mathf.Round(health));
      
}

function Reset(){
	
	transform.position = Vector3(0,0,0);
		
	health = startHealth;
	print("your dead");

}


function OnTriggerEnter (theCollider : Collider) {
	 
	 if(theCollider.tag == "enemy" ) 
	 {
	 	health -=damageRate * Time.deltaTime;
	 }	
}

i had trouble adding tags too.
the problem is that the text field is the same color as the background of the tag manager
alt text

when you open the tag manager you have two columns
the number and the tag name.
place your mouse over the word water in the second column and move down until it is in line with user layer 8 in the first column if you there you will be able to type in a text field and make your own layer.