Keeping score when object clicked and destroyed

I’m having problems keeping score when destroying objects when they are clicked. I think its because of the clones I’m generating.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class Touch : MonoBehaviour {

	public GameObject pinnedRing;
	RaycastHit2D hitInfo;
	public int score;

	void Start()
	{
		score = 0;
	}

	void Update () {
		if (Input.GetMouseButtonDown (0)) {
			//Debug.Log ("Clicked");
			Vector2 pos = new Vector2(Input.mousePosition.x, Input.mousePosition.y);
			RaycastHit2D hitInfo = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(pos), Vector2.zero);
			if(hitInfo.collider.tag == "Ring")
			{
				score += 1;
				Destroy (hitInfo.collider.gameObject);
				Vector3 pinPos = hitInfo.transform.position;
				GameObject secondRing = Instantiate (pinnedRing, pinPos, transform.rotation);
				Destroy(secondRing, 1f);
			}
			if(hitInfo.collider.tag != "Ring")
			{
				//Do nothing
			}
		}
		Debug.Log (score);
	}
}

Basically, I spawn the objects and when I click them they disappear, but the score doesn’t add, it just keeps on 0. How can I fix this?

You need to check if the raycast hit anything at all, because if not, then hitInfo.collider will be null, and so accessing hitInfo.collider.tag will give the error you described in the comment.

In code:

RaycastHit2D hitInfo = ...;
if (hitInfo.collider == null) { /* do nothing */ }
else {
    // do the same as you did originally
}

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Touch : MonoBehaviour {

public GameObject pinnedRing;
private int score;
Vector3 pinPos;

void Start()
{
	score = 0;
}

void Update() {

	RaycastHit2D hitInfo = Physics2D.Raycast (Camera.main.ScreenToWorldPoint (Input.mousePosition), Vector3.forward, Mathf.Infinity);

	Debug.DrawRay (Camera.main.ScreenToWorldPoint (Input.mousePosition), Vector3.forward, Color.red);

	if (hitInfo.collider != null) {
		if (hitInfo.collider.tag == "Finish") {
			score += 1;
			pinPos = hitInfo.transform.position;
		    Destroy (hitInfo.collider.gameObject);
			Invoke("Spawn",1f);
		}
		Debug.Log ("done");
		if (score > 0)
			Debug.Log (score);
	}
}

void Spawn()
{
	GameObject secondRing = Instantiate (pinnedRing, pinPos, Quaternion.identity);
}

}