Raycast not giving damage

My Raycast will not give damage to my enemy.

screenshot of a code editor

// paste your code here

does anyone know how to fix it?

You are not reducing the health of an enemy you got from the raycast, but some random enemy referenced by the serialized field. Just use GetComponent to get the actually hit enemy from the raycast hit.
In that case, you don’t need to use the tag, since the component itself is the tag.

Hey, does your enemy object have “Enemy” tag ? and try the giving distance parameter for raycast

I have Fixed the Code and instead of using tags i used a layer and damage was being dealt if anyone has the same issue heres the code for it

{
    
    //Game Objects 
    [SerializeField] Camera cam;
    //Particle Systems
    [SerializeField] ParticleSystem muzzelFlash;
    //Audio
    [SerializeField] AudioClip gunShot;
    [SerializeField] AudioSource Source;
    //Animation
    [SerializeField] Animation gunShotAnim;
    //Floats
    [SerializeField] float Damage = 25f;
    //Scripts being called
    [SerializeField] Enemy script;
   
  

    
    void Update()
    {
        if (Input.GetButtonDown("Fire1"))
        {
            Effects();
            Shooting();
        }
    }
    void Effects()
    {
        muzzelFlash.Play();
        Source.PlayOneShot(gunShot);
        Debug.Log("you have shot your gun");
        gunShotAnim.Play();
    }
    void Shooting()
    {
        RaycastHit hit;

        if (Physics.Raycast(cam.transform.position, cam.transform.forward, out hit))
        {
            Debug.Log("We hit" + hit.transform.name);
            if(hit.collider.gameObject.layer == 3)
            {
                script.zombieHealth -= Damage;
            }
        }
    }
}