health and damage system help

Hi im trying to make a simple health system that will cause the player to lose 10 hp if he walks into a ball. But i cant get it to work, here is my code so far

var curHealth : int = 50; //set current health
var maxHealth : int = 100; //set max  health
var healthPerSec : int = 1; // health regen per second
var alive : boolean = true; // set the player to alive

//not working 
function OnCollisionHit(hit : 	Collider) {

if (hit.gameObject.CompareTag == "ball"){
	
	curHealth -= 10;

}
}


function Update () {


 //tets if player should be alive
 if(curHealth <= 0){
 	
 	alive = false;
 	}
} 	

function Start  () {
 
 
	autoHealthRegen();
	
	
}
 
// regen health
function autoHealthRegen () {
 
 
	for(var e=1;e>0;e++) {
 
		yield WaitForSeconds(1);
 
		if(curHealth < maxHealth) {
 
			curHealth= curHealth + healthPerSec;
 
		}
 	}
}

This line is wrong

if (hit.gameObject.CompareTag == “ball”){

You are comparing a function with a string, allowed because of UnityScript loose typing.

You want to use either

if (hit.gameObject.CompareTag("ball")){

or

if (hit.gameObject.tag == "ball"){

Also, did you check out @vexe’s comment above?