I have a coin pickup system that after the player dies, the script isnt added into the Player(Clone)

this is my code, how do i keep it running even after the player dies

var score = 0;
var scoreText = “Score: 0”;
var mySkin : GUISkin;

function OnTriggerEnter( other : Collider ) {

if (other.tag == "Coin") 
	{
    score += 1;
    scoreText = "Score: " + score;
    Destroy(other.gameObject);
}

}

function OnGUI () {
GUI.skin = mySkin;
GUI.Label (Rect (10, 10, 500, 200), scoreText.ToString()); }

I’m not really sure that if it is in same scene or if scene changes and you need to save it.
But both ways you need to make game object where to put your scores.

if scene does not change:

First create a empty game object to assign the following script

ScoreScript:

var score = 0;
function OnGUI () {
GUI.Label(Rect(10, 10, 200, 100), "Score: " + score.ToString());
}

Add this to player and then int “scoreObject” you need to assign empty game object you just made

PlayerScript:

var score = 0;
var scoreScript : ScoreScript;
var scoreObject : GameObject;

function Start () {
//accessing from this script to other script on other object
scoreScript = scoreObject.GetComponent("ScoreScript");
}

function OnTriggerEnter( other : Collider ) {

if (other.tag == "Coin")
    {
    score += 1;
    scoreScript.score += 1;
    Destroy(other.gameObject);
  }
    
}

I hope this works I did not test this.