How to create own text using 3D Text?

How do I create my own text with 3D Text?
For guiText I know is this:

OnGUI function ()
{
guiText.text = "text";
}

Just do not know how it is with 3D text. How would it be?

TextMesh.text

The code is like this:

var textMesh : TextMesh;
static var score : int = 0;

function Start(){
    textMesh = gameObject.GetComponent(TextMesh);
}

function Update() {
    textMesh.text = score + "%";
}

Thanks!