How to make a score counter on player death?

I can’t figure out a way for the score to rest on player death.
using UnityEngine;
using UnityEngine.UI;

public class CoinCounterText : MonoBehaviour {

    Text text;
    public static int coinAmount;

    // Use this for initialization
    void Start()
    {
        text = GetComponent<Text>();
    }

    // Update is called once per frame
    void Update()
    {
        text.text = coinAmount.ToString();
    }
}
// Coin Script

using UnityEngine;
using UnityEngine.UI;

public class CoinCounterText : MonoBehaviour {

    Text text;
    public static int coinAmount;

    // Use this for initialization
    void Start()
    {
        text = GetComponent<Text>();
    }

    // Update is called once per frame
    void Update()
    {
        text.text = coinAmount.ToString();
    }
}

You want to increase score on players death or stop increasing value either you should use bool value to control it for ex. if player dead set bool value " playerDead = true" either in player script or coin script and check bool vale in coin script update

if(playerDead)

{

   coinAmount++;
    text.text = coinAmount.tostring();

}

or

you can use OnTriggerEnter or OnCollisionEnter function for collision detection when player collide with coin (if game is in 3d) and isTrigger is on in editor then use OntriggerEnter and in crease value use can google for OnTrigger,OnCollision,OntriggerEnter2d,OnCollisionEnter2D.

Thank You
Aditya.