Melee system script help

#pragma strict

var Damage : int = 25;
var Distance : float;

function Update ()
{ 
	if (Input.GetButtonDown("Fire1"))
	
		var hit : RaycastHit;
if (Physics.Raycast (transform.position, transform.TransformDirection(Vector3.forward, hit))
	 	)
	 		{Distance = hit.distance;
           hit.transform.SendMessage("ApplyDamage", Damage, SendMessageOptions.DontRequireReceiver);  
	 	}  
} 

;

This is a script for a melee system but i keep getting an error message saying
“Assets/Themeleesystem.js(11,70): BCE0023: No appropriate version of ‘UnityEngine.Transform.TransformDirection’ for the argument list ‘(UnityEngine.Vector3, UnityEngine.RaycastHit)’ was found.”

How can this be fixed. Any help will be appreciated
if it matters its unity 3D

There’s a misplaced right parenthesis:

if (Physics.Raycast (transform.position, transform.TransformDirection(Vector3.forward, hit))
   )

The first right parenthesis should be after Vector3.forward, like this:

if (Physics.Raycast (transform.position, transform.TransformDirection(Vector3.forward), hit))

But you could simplify this statement as follows:

if (Physics.Raycast (transform.position, transform.forward, hit))