I am trying destroy a game object using ray cast! Not working?

using UnityEngine;
using System.Collections;

public class RemoveObstruction : MonoBehaviour {
GameObject mainCamera;

// Use this for initialization
void Start () 
{
	mainCamera = GameObject.FindWithTag("MainCamera");
}

// Update is called once per frame
void Update () 
	 {
		if(Input.GetKeyDown (KeyCode.R)){
			int x = Screen.width / 2;
			int y = Screen.width / 2;
	}

		Ray ray = mainCamera.camera.ScreenPointToRay(new Vector3(x,y));
		RaycastHit hit;
		if(Physics.Raycast(ray,out hit)){
			Obstruction o = hit.collider.GetComponent<Obstruction>;
				Destroy (o);
			}
	}

}

Try destroying the game object with the Obstruction component.

Destroy( o.gameObject );

Or just cut out the middle man and destroy the game object without getting its Obstruction component.

And, of course, make sure the object you’re trying to destroy has a collider.