whats wrong with my code???

its C# and when my enemy walks up to me and is in hitting distance it does nothing

using UnityEngine;
using System.Collections;

public class EnemyMelee : MonoBehaviour {
    public GameObject target;
    public float    attackTimer;
    public float coolDown;

    // Use this for initialization
    void Start () {
        attackTimer = 0;
        coolDown = 2.0f;
    }

    // Update is called once per frame
    void Update () {

        if(attackTimer > 0)
            attackTimer -= Time.deltaTime;

        if(attackTimer < 0)
            attackTimer = 0;

            if(attackTimer == 0)
            Attack();
            attackTimer = coolDown;

    }
    private void Attack() {

        Vector3 dir = (target.transform.position - transform.position).normalized;

        float direction = Vector3.Dot(dir, transform.forward);

        float distance = Vector3.Distance(target.transform.position, transform.position);

        if(distance < 3f){
            if(direction > 0) {
        PlayerHealth eh = (PlayerHealth)target. GetComponent("PlayerHealth");
        eh.AdjustcurrentHealth(-10);

            }

        }

    }

}

Your problem is that attackTimer is set to coolDown on every call of Update(). You are missing the braces for your equal to 0 if conditional. So only the Attack() call is being tied to it leaving the coolDown assignment unconditional.

What you need is...

if(attackTimer == 0) {
    Attack();
    attackTimer = coolDown;
}