(Solved!) How to Destroy tagged items using raycast?

Thanks to everyone who helped im very grateful. The Script Works and destroys the object fine.

This is my Code
EDIT : Changed it but still does not work

UPDATED SCRIPT Thanks To alucardj

PS

! I can hit the object and it shows in the debug but it still doesn’t destroy it !

  if (Input.GetMouseButtonDown(0)){       
    var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
    var hit : RaycastHit;

    if (Physics.Raycast(ray, hit, 1000)){ // 1000 or Mathf.Infinity should be enough !
        // what did the raycast hit ?
        Debug.Log( "ray hit (name): " + hit.collider.gameObject.name);
        Debug.Log( "ray hit (tag): " + hit.collider.gameObject.tag );

        if(hit.collider.gameObject.tag == "prop")
        {           
            Destroy(hit.collider.gameObject);
        }
    }
}

your code looks ok, but you can’t access “gameObject” directly from the hit, instead use collider:

http://docs.unity3d.com/Documentation/ScriptReference/RaycastHit.html

if (Input.GetMouseButtonDown(0)){       
    var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
    var hit : RaycastHit;

    if (Physics.Raycast(ray, hit)){
   if(hit.collider.tag == "prop")
        {           
          Destroy(hit.collider.gameObject);
     }
   }
}

Note that for a Raycast to work, your object needs to have a Collider attached…