How to set a counter to increase as an object increases on the X axis

Hey, I am trying to develop a GUIText when the object (Player) increases on the x axis. For every 6 units I want 1 extra point be displayed on the GUIText. This is the code I am using:

#pragma strict

var score : float = distance / 6;

function Start () {

}

function Update () 
{
	if(gameObject.tag == "Player" + (6, 0, 0)
	{
    	GUI.Label(Rect((Screen.width / 2) + 20,10, 200, 30), "Score: " + score);
    	
}

What am I doing wrong?
Thanks in advanced.

GUI functions can only be executed inside the OnGUI() callback. So to display your text you you would do:

function OnGUI() {
    GUI.Label(Rect((Screen.width / 2) + 20,10, 200, 30), "Score: " + score);
}

Unless you are dynamically changing your tags, I’m not sure about your if() logic. If it is good, you can put it in the OnGUI() as well, but I’d start by just getting the text to display.