My Player object contain script HealthBar, which contain a public variable currentHealth. I want to access it from another game object, but my code doesn’t work:
var player : Transform;
function Attack()
{
player.GetComponent("player").currentHealth -= 10;
}