Total Score

I have a game that you collect coins in and it shows you how many you have and when you die it turns to 0. I wanted to know how i could get it to show the total coins i have even after you die; so that when you die the score gets added onto total score.

With a variable.

public static class Score {

    public static float total;

}

public class Player : MonoBehaviour {

    float score;

    void OnDeath() {
 
        Score.total += score;
 
    }

}

thanks