I am having diffuclties with Raycasting

Alright here is my code:

 var left = (transform.TransformDirection(-Vector3.right));

var hit : RaycastHit;

    if(Physics.Raycast(transform.position, left, 5, hit)){
        if (hit.collider.gameObject.transform.tag == "Player") {
            if(Input.GetKey("e")) {
                Debug.Log("Left Works");
            }
        }
    }

That all is in the Update function. The problem is it is saying that there is no appropriate version of Physics.Raycast like the one I. But when i check the scripting reference it says this is a okay way to do this. I have also used a similar way like this in the past, so i have no idea what the problem is. Any help will be appreciated.

Try swapping around the '5' and 'hit' as per the second set of examples in the scripting reference. You also don't need the outside set of brackets around your left variable declaration. The following works for me:

function Update(){

var left = transform.TransformDirection(-Vector3.right);

var hit : RaycastHit;

    if(Physics.Raycast(transform.position, left, hit, 5)){
        if (hit.collider.gameObject.tag == "Player") {
        Debug.Log("hit the player");
            if(Input.GetKey("e")) {
                Debug.Log("Left works");
            }
        }
    }
}