Can't return hit.point with raycast?

I was writing a piece of code to set the endpoint of a linerenderer to equal the hitpoint of a raycast. Halfway through, I discovered that the raycast itself doesn’t recognize gameobjects or even transforms. When I try to print hit.point, it gives me 0, 0, 0. If I try to return hit.transform, it gives me a null message. I don’t know what’s going on with this.

private var ray : Ray;
private var hit : RaycastHit;

function Update () {

	var fwd = transform.TransformDirection (Vector3.forward);
	//var lineRenderer : LineRenderer = GetComponent(LineRenderer);

	if (Physics.Raycast (transform.position, fwd)) {
	
	//lineRenderer.SetPosition(hit.point);
	
	print(hit.point);
	}
}

I commented out the parts dealing with the linerenderer. I haven’t really gotten into that part yet because of the problems I’m having with the raycast.

You need to pass the hit variable to the Raycast function, as a parameter, so it will be filled up. In C# you need the prefix out, I don’t know about javascript though. Doc will show you the way.