Get Score distance! Help!

Hi, I need a script to get the distance traveled by “X” object and add the score. Example, I have this script that I put under to increase the score every time I collide with a “Coin”

  static var Counter : int = 0;
    
     
    function Update () { 
     GetComponent.<TextMesh>().text = "" + Counter; }

I attach this script to my 3D Text for the coin collection.

Now, if I create another static var and another script to get the player’s distance, which script should it be?

I hope you can help me please.

Greetings

HELPPPPPPPPPPPPPPP!!!