Losing Life

Hello I would like to know how to make a script for my object lose 1 life every click on top of it so on.

Put this in your main controller or whatever script you want.

using UnityEngine;

public class GetObjectOverCursor : MonoBehaviour
{
    void Update ()
    {
        if (Input.GetMouseButtonDown(0))
            {
                Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                RaycastHit h = new RaycastHit();
                Physics.Raycast(ray, out h, 50f);
                if (h.collider != null)
                {
                    Debug.Log("colliding against: " + h.transform.name); //the object has been taken, save it in some variable or do whatever what you want with it
                }
                else
                {
                    Debug.Log("nothing is colliding");
                }
            }
    }
}