can someone look at this script for me

i need help finding out whats wrong with this. it gives me no error and i can play but once my enemy shows up, it gives me a error. i want him to show up and not move until my flashlights points on him. so im trying to create a raycast to hit the flashlight and when it i want the enemy to chase me, if that makes sense

var Player : Transform;
var moveSpeed = 1;
var maxDist = 5;
var minDist = 1;
var length = 30;

function Update()
{
	var hit : RaycastHit;
	var ray : Ray = Transform.Position(Vector3.forward);
	
	transform.LookAt(Player);
	
	if(Physics.Raycast(ray, hit, length))
	{
		if(hit.collider.tag == "FlashLight")
		{
			if(Vector3.Distance(transform.position, Player.position) >= minDist)
			{
				transform.position += transform.forward*moveSpeed*Time.deltaTime;
			}
		}
	}
}

Issues like this one are a good reason why you should always use ‘#pragma strict’ at the top of your files. With the pragma you would have received a compile-time error and would have seen the problem. I suggest you change to a different form of Raycast. Try this:

var Player : Transform;
var moveSpeed = 1;
var maxDist = 5;
var minDist = 1;
var length = 30;
 
function Update()
{
    var hit : RaycastHit;
 
    transform.LookAt(Player);
 
    if(Physics.Raycast(transform.position, transform.forward, hit, length))
    {
       if(hit.collider.tag == "FlashLight")
       {
         if(Vector3.Distance(transform.position, Player.position) >= minDist)
         {
          transform.position += transform.forward*moveSpeed*Time.deltaTime;
         }
       }
    }
}