this is my code in onControllerColliderHit
“EnemiesAttack” is the name of another script
if(Hit.gameObject.tag == "enemiesAttack")
{
var currentAttack:GameObject = Hit.gameObject;
var damage:int = currentAttack.GetComponent(EnemiesAttack.attackPower);
hpPlayer = hpPlayer - damage;
Destroy(currentAttack);
Debug.Log(hpPlayer);
}
and this is the code that i attached on the object i tagged “enemiesAttack”
var attackPower:int=10;
function Update ()
{
}
i want hp of the player to be decreased with the amount of attackPower …
i dont know what i did wrong , im new at unity and new at programming as well
plss help me thx