Translating from game space to view space

I’m trying to overlay a gui element onto the gameobject this script is attached to. But I keep getting an error that states :

Assets/flashing_script.js(16,19): BCE0023: No appropriate version of 'UnityEngine.GUI.Label' for the argument list '(UnityEngine.Rect, float)' was found.

Any help would be wonderful. I’m pretty much a noob at this :).

var timer : float = 3;

var viewportPos : Vector3;


function Update () {
	

		viewportPos = Camera.main.WorldToViewportPoint(transform.position);
	
}

function OnGUI () 
{
			
	GUI.Label (Rect (viewportPos.x, viewportPos.y, 20.0, 20.0), timer);	
	
}

Label needs a string, so pass it timer.ToString(), instead of timer.

GUI.Label only takes strings, so you have to convert “timer” to a string. (Using ToString().) Also, please format your code using the code button.