gameObject tag

i am trying to log in console when ray hit coal. I tagged coal in tag inspector, but nothing comes up when ray hits the coal block. here is my code.

if(Input.GetMouseButton(0)){
			Debug.DrawRay(transform.position, fwd, Color.green);
		
			if (Physics.Raycast (transform.position, fwd, hit, 1)){
			 	if(gameObject.tag == "Coal"){
			 			Debug.Log("Found coal!!!");
			 		}
			}
		}

You are searching for your own tag, not the object that was hit tag, change the line “if(gameObject.tag == “Coal”){” to “if(hit.collider.tag == “Coal”){” and that should work

#pragma strict

function Update () {

var hit : RaycastHit;
var ray : Ray = Camera.main.ScreenPointToRay(Input.mousePosition);
     if(Physics.Raycast(ray, hit) && hit.collider != null)
     {
     Debug.Log(hit.transform.tag);
     }
}