Hit distance Change light range

Hi guys, i am trying to define the light range to the Hit.distance ( the light is a flash light to a weapon ) but the light is defective :confused: have other way?

The Script :

function Update () {

var Hit : RaycastHit;

var Range : float = Mathf.Infinity;

var DirectionRay = transform.TransformDirection(Vector3.forward);

Debug.DrawRay(transform.position, DirectionRay * Range, Color.white);

if(Physics.Raycast(transform.position, DirectionRay, Hit, Range)){

	light.range = Hit.distance;
	light.intensity = Hit.distance;

}

}

Problem Solved:

var additionalPosition : float;

function Update () {

var Hit : RaycastHit;

var Range : float = Mathf.Infinity;

var DirectionRay = transform.TransformDirection(Vector3.forward);

Debug.DrawRay(transform.position, DirectionRay * Range, Color.white);

if(Physics.Raycast(transform.position, DirectionRay, Hit, Range)){
	
	var distance  = Hit.distance * additionalPosition;
	
	light.range = distance;
}

}

( I do with the lighting grip the object Normal Distance + something ^^ ) What do you think?