CS0029 error

I want to be able to make the damage from one script be applied to an enemy from another script:

void Update()
{
    if (thirdPersonController.AttackOnCLick());
    {

    }
}

(third person controller script)

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class thirdPersonController : MonoBehaviour
  
 {private staminaManager staminaManager; // Reference to the StaminaManager
 private healthManager healthManager; // Reference to the healthManager
    public float speed = 5.0f;
  
public GameObject Player;
    public float rotationSpeed = 200.0f;
    public float jumpForce = 2.0f;
    public float sprintSpeed = 10.0f;
     private bool isJumping = false;
public float walkSpeed = 1.0f;
       
    public Animator animator; // Animator component

    public Rigidbody rb;
    public Rigidbody gsrb;
    public GameObject world;
  public KeyCode attackKey;
  public GameObject Greatsword;
    void Start()
    {
        animator.enabled = true;
        animator.enabled = false;
        animator.enabled = true;
     staminaManager = FindObjectOfType<staminaManager>(); // Find the StaminaManager in the scene
       healthManager = FindObjectOfType<healthManager>(); // Find the healthManager in the scene
       gsrb.isKinematic = true;
       gsrb.useGravity = false;

    }
// kill if below map

    void FixedUpdate()
    {   KillAtZeroHealth();
    
    if (Player.transform.position.y <= -5.0f) {
      healthManager.currentHealth = 0.0f;
      
    }
      
   

     
     //movemebt
        float moveHorizontal = Input.GetAxis("Horizontal");
        float moveVertical = Input.GetAxis("Vertical");
        
        Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
            // movement
             if (Input.GetKey(KeyCode.LeftShift))
        {
            rb.AddForce(movement * sprintSpeed);
          animator.SetBool("Run", true); // Play the running animation
           // transform.Translate(Vector3.forward * Time.deltaTime * sprintSpeed);
        }
        else
        {
            rb.AddForce(movement * speed);
            animator.SetBool("Run", false); // Stop the running animation
           // transform.Translate(Vector3.forward * Time.deltaTime);
        }
       
        // Rotate the player to face the direction of movement
      //  if (movement != Vector3.zero)
      //  {
      //      Quaternion toRotation = Quaternion.LookRotation(movement, Vector3.up);
       //     transform.rotation = Quaternion.RotateTowards(transform.rotation, toRotation, rotationSpeed * Time.deltaTime);
      //  }

        // Make the player jump if the jump button is pressed
        if (Input.GetButtonDown("Jump") && !isJumping)
        { if (staminaManager.currentStamina <= 15f)
            {rb.AddForce(new Vector3(0, jumpForce, 0), ForceMode.Impulse);
            isJumping = true;
             staminaManager.UseStamina(15f);
              animator.SetTrigger("Jump"); // Play the jump animation
            }        
        }
        
           float horizontalInput = Input.GetAxis("Horizontal");
        float verticalInput = Input.GetAxis("Vertical");
    bool Walk = Mathf.Abs(horizontalInput + verticalInput) > 0.1f;

       transform.Translate(Vector3.forward * Time.deltaTime * speed * verticalInput);
		// Rotation
		transform.Rotate(Vector3.up, rotationSpeed * horizontalInput * Time.deltaTime);
 

    animator.SetBool("Walk", Walk);
    animator.SetFloat("Speed", (horizontalInput + verticalInput) * walkSpeed);
    // attacking
    AttackOnCLick();
    }

    // Detect collision with the ground
    void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.CompareTag("Ground"))
        {
            isJumping = false;
        }
    }
    void KillAtZeroHealth()
    {
   if (healthManager.currentHealth <= 0){
     healthManager.ShowYouDied();
        animator.SetTrigger("Death"); // Play the dying animation
      
        animator.enabled = false;
          healthManager.ShowYouDied();
          //drop sword
   gsrb.isKinematic = false;
       gsrb.useGravity = true;

          GetComponent<thirdPersonController>().enabled = false; // Disable this script
         }
     else {
      animator.enabled = true;
     }
    }
     public void AttackOnCLick(){if (Input.GetKeyDown(attackKey))
        { if (staminaManager.currentStamina >= 5.0f){
              animator.SetTrigger("Attack"); // Play the attack animation
                // Reduce stamina (example: decrease by 10 units)
            staminaManager.UseStamina(5f);
        }
        }
     }
}