How to convert a float to a string and then have it appear in a gui rect

Hi all, Just a quick syntax question as the Unity documentation was pretty much useless in this regard. I am trying to fetch a variable from one script (float) and put it in another (as a string) that is constantly updating. I have perused the forums but found nothing of use in this regard. Here is my javascript so far:

function Update () 
{
getHorSpeed = gameObject.GetComponent(PlayerMovement.horAcceleration).ToString();
}
function OnGUI () 
{
    GUI.Box (Rect (Screen.width - 100, Screen.height - 50, 100, 50), GUIContent ("Speed", getHorSpeed));
}

At the moment the syntax is wrong for the GetComponent line. Can someone help me with this or point me at some good reference documentation? Thanks in advance

here is the fix: "I assume PlayerMovement is your script"

getHorSpeed = gameObject.GetComponent("PlayerMovement").horAcceleration.ToString();

The horAcceleration should be defined static to be able to access it globally.

Hope it helps.

using UnityEngine;

using System.Collections;

public class NAMEOFSCRIPT : MonoBehaviour {

public string horSpeed;
public PlayerMovement pm;

void Start () {
	
	
	horSpeed = pm.horAcceleration.ToString();


}

void OnGUI(){
	
	GUI.Box (new Rect (Screen.width - 100, Screen.height - 50, 100, 50), horSpeed);	
}
}

this is c# but try it,
attach the right script (if needed),
change NAMEOFSCRIPT to the name of the c# script

I am now getting a NullReferenceException: Object reference not set to an instance of an object on the line starting with getHorSpeed var horSpeed : String;

function Update () 
{
    getHorSpeed = gameObject.GetComponent("PlayerMovement").horAcceleration.ToString();
    var horSpeed: String = getHorSpeed;
}
function OnGUI () 
{
    GUI.Box (Rect (Screen.width - 100, Screen.height - 50, 100, 50), GUIContent (horSpeed));

}

How do I reference the product of the ToString method?