Can someone help me to understand why this raycast is not working properly?

            RaycastHit hit;
            var rayDirection = Player.transform.position - Enemy.transform.position;
            Debug.DrawRay(transform.position, rayDirection);
            if (Physics.Raycast(transform.position, rayDirection, out hit)) { 
                if (hit.collider.gameObject.tag == "Player"){
                    Debug.Log("Works");
                } 
                else {

                }
            }

This code is inside of the update function. Basically, the ray is drawn in the right position, but the Debug.Log(“Works”); is never printed into the console. I am trying to make this so the enemy will only shoot at the player when they are in direct line of sight.

Thanks for the help!

Did you add the “Player” tag to the object you’re shooting?