not sure how to access other scripts right

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");
}

}

GetComponent [Edit: with a string parameter] only returns a Component object. You will have to typecast it to your required type first.

Try

var script:HealthBarScript = enemy.transform.root.gameObject.GetComponent("HealthBarScript");

Edit:
Or better use Eric’s solution and use a Type parameter instead. You could (and should) still use strong typing for your variables though.

var script:HealthBarScript = enemy.transform.root.gameObject.GetComponent(HealthBarScript);

you need to declare the variable type so instead of
var script =
use

var script : HealthBarScript =