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.

			Debug.DrawRay(transform.position, fwd,;
			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)