what wrong with my healthbarscript

I am trying to make a script for at healthbar. I have try to make 2 system 1 with 3 script(on 2 child og the same gameobject) and the other with 1 script(1 child og the same gameobject) … the first one works fine… only error is that it all max hp gets overwritt by the last instantiate monster… the other one seens to have all the nummers rigtig … hp , maxhp. but now the player cant hit it anymore.

// player script

var force : int;
var allowfire = true;
var fireRate = 0.1;
var distance : float;// hvor lang kan man skyde

function Start () {

}

function Update () {

var hit : RaycastHit;
var dir = transform.TransformDirection(Vector3.forward);//raycast lige frem

if(Input.GetMouseButtonDown(0) && allowfire == true){
Fire();

Debug.DrawRay(transform.position, dir * distance, Color.blue);
Debug.Log(“fire”);

if (Physics.Raycast(transform.position, dir, hit, distance))//transform.position
//if (Physics.Raycast(transform.position, dir, hit, distance))//transform.position
{

if (hit.collider.gameObject.tag == "target"){
hit.rigidbody.AddForceAtPosition(dir * force,hit.point);// sender det som man rammer tilbage med en kraft :)
hit.collider.SendMessageUpwards("ApplyDamage", 1.0, SendMessageOptions.DontRequireReceiver);
Debug.Log("Hit");
}
}
}

if(Input.GetMouseButton(1)  && allowfire == true){
Fire();
Debug.DrawRay(transform.position, dir * distance, Color.blue);
Debug.Log("fire");
Debug.Log(transform.position);

if (Physics.Raycast(transform.parent.position, dir, hit, distance))
{

if (hit.collider.gameObject.tag == "target"){
hit.rigidbody.AddForceAtPosition(dir * force,hit.point);
hit.collider.SendMessageUpwards("ApplyDamage", 1.0, SendMessageOptions.DontRequireReceiver);
Debug.Log("Hit");
}
}
}


}

function Fire()
{
allowfire = false;
yield WaitForSeconds(fireRate);
allowfire = true;
}

//first script on healthbar
var target : Transform;
var rotationSpeed : int;

var myTransform : Transform;
function Awake()
{
myTransform = transform;
}

function Start () {

var go = GameObject.FindGameObjectWithTag(“Player”);
target = go.transform;

}

function Update () {
Debug.DrawLine(target.transform.position, myTransform.position, Color.green);

//Look at player
myTransform.rotation = Quaternion.Slerp(myTransform.rotation, Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed * Time.deltaTime);

}

//secornd script on haelth bar

var scaleX : float;
var hp : float;
var maxHp : float;

function Awake()
{

}

function Start () {
scaleX = transform.localScale.x;

}

function Update () {

maxHp = modstanderhp.maxHP;
hp = modstanderhp.HPpublic;

if(scaleX !=0 && hp != 0 && maxHp != 0){
transform.localScale.x = (scaleX * (hp/maxHp));
}
}
// script on piot to hit target
var self : GameObject;
var HP : int; //hvor mange HP har den
var HPMax : int;
var HPmin : int;
var gotHit : boolean ;
static var HPpublic;
static var maxHP;

function Awake()
{
Respawn();
}
function Start () {

}

function Update () {
HPpublic = HP;

//sår bare zombien
if(gotHit == true && HP >0 ){
gotHit = false;
HP = HP - 1;
}

if(gotHit == true && HP==0 ){
gotHit = false;
ControllSpawn.currentzombie --;
Destroy(self);
}
}

function Respawn(){
HP = Random.Range(HPmin,HPMax);
this.maxHP = HP;

}

function ApplyDamage (damage : float) {
gotHit = true;

}

//complet script in one
var scaleX : float;
var hp : float;
var maxHp : float;

var self : GameObject;
var HPMax : int;
var HPmin : int;
var gotHit : boolean ;

var target : Transform;
var rotationSpeed : int;

var myTransform : Transform;
function Awake()
{
myTransform = transform;
maxHp = Random.Range(HPmin,HPMax);
hp = maxHp;
}

function Start () {

scaleX = transform.localScale.x;
var go = GameObject.FindGameObjectWithTag(“Player”);
target = go.transform;
}

function Update () {

collider.size = Vector3((scaleX * 1 *(maxHp/hp)), 1, 1);
Debug.DrawLine(target.transform.position, myTransform.position, Color.green);
//Look at player
myTransform.rotation = Quaternion.Slerp(myTransform.rotation, Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed * Time.deltaTime);

if(gotHit == true && hp > 1 ){
gotHit = false;
hp --;
}
if(gotHit == true && hp == 1 ){
gotHit = false;
ControllSpawn.currentzombie --;
Destroy(self);

}

}

if(scaleX !=0 && hp != 0 && maxHp != 0){
transform.localScale.x = (scaleX * (hp/maxHp));

}

function ApplyDamage (damage : float) {
gotHit =; true;

}

`This script cant get hit by the player

var scaleX : float;
var hp : float;
var maxHp : float;

var self : GameObject;
var HPMax : int;
var HPmin : int;
var gotHit : boolean ;

var target : Transform;
var rotationSpeed : int;


var myTransform : Transform;
function Awake()
{
myTransform = transform;
maxHp = Random.Range(HPmin,HPMax);
hp = maxHp;
}

function Start () {


scaleX = transform.localScale.x;
var go = GameObject.FindGameObjectWithTag("Player");
target = go.transform;
}


function Update () {

collider.size = Vector3((scaleX * 1 *(maxHp/hp)), 1, 1);
Debug.DrawLine(target.transform.position, myTransform.position, Color.green);
//Look at player
myTransform.rotation = Quaternion.Slerp(myTransform.rotation, Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed * Time.deltaTime);

if(gotHit == true && hp > 1 ){
gotHit = false;
hp --;
}
if(gotHit == true && hp == 1 ){
	gotHit = false;
	ControllSpawn.currentzombie --;
	Destroy(self);
	
	}
 }


if(scaleX !=0 && hp != 0 && maxHp != 0){
transform.localScale.x = (scaleX * (hp/maxHp));




 
 
}

function ApplyDamage (damage : float) {
gotHit = true;

}
//playerscript for attakt
var force : int;
var allowfire = true;
var fireRate = 0.1;
var distance : float;// hvor lang kan man skyde

function Start () {

}


function Update () {


var hit : RaycastHit;
var dir = transform.TransformDirection(Vector3.forward);//raycast lige frem


if(Input.GetMouseButtonDown(0)  && allowfire == true){
Fire();


Debug.DrawRay(transform.position, dir * distance, Color.blue);
Debug.Log("fire");


if (Physics.Raycast(transform.position, dir, hit, distance))//transform.position
//if (Physics.Raycast(transform.position, dir, hit, distance))//transform.position
	{
	
	if (hit.collider.gameObject.tag == "target"){
	hit.rigidbody.AddForceAtPosition(dir * force,hit.point);// sender det som man rammer tilbage med en kraft :)
	hit.collider.SendMessageUpwards("ApplyDamage", 1.0, SendMessageOptions.DontRequireReceiver);
	Debug.Log("Hit");
	}
	}
	}
	
	if(Input.GetMouseButton(1)  && allowfire == true){
	Fire();
	Debug.DrawRay(transform.position, dir * distance, Color.blue);
	Debug.Log("fire");
	Debug.Log(transform.position);

if (Physics.Raycast(transform.parent.position, dir, hit, distance))
	{
	
	if (hit.collider.gameObject.tag == "target"){
	hit.rigidbody.AddForceAtPosition(dir * force,hit.point);
	hit.collider.SendMessageUpwards("ApplyDamage", 1.0, SendMessageOptions.DontRequireReceiver);
	Debug.Log("Hit");
	}
	}
	}
	


	}
	


function Fire()
{
    allowfire = false;
    yield WaitForSeconds(fireRate);
    allowfire = true;
}