Detect if object clicked on

I have a script to detect if an object has been clicked on but when I click nothing happens

var selectedUnits : Array = new Array();
function Update (){

	if(selectedUnits.length <= 0){
	
		if(Input.GetMouseButtonDown(0)){
		
		var hit : RaycastHit;
			Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), hit);
			Debug.Log(hit.collider.tag);
}
}
}

if(selectedUnits.length <= 0){

how can the length be less than zero? start by getting rid of that line, and if that doesn’t do it, make sure your object has a COLLIDER attached

Robertu got it right. The script was not attached to the object.
Thanks for the help.