ok what i am tring to accomplish here is on the bullet prefab when it hits the enemy it removes health the error im getting is"“”“Assets/_scripts/Bullet.js(21,32): BCE0019: ‘currHealth’ is not a member of ‘UnityEngine.Component’.,”“” I coppy and pasted just tomake sure i have it right. this is the hole function currhealth is the var its not finding.
function OnTriggerEnter(enemy : Collider){
if(enemy.tag == "enemyAim"){
var script = enemy.transform.root.gameObject.GetComponent("HealthBarScript");
if(script.currHealth != 0){
script.currHealth -= 15;
Destroy(this.gameObject);
}
}else{
yield WaitForSeconds(.25);
Destroy(this.gameObject);
//print("time death");
}
}