Why can't I get ball movement with this script?

I have been trying to figure out how to add an impulse force on the ball with a button press. I can get movement from the ball with the commented out OnMouseDown() method, but I cannot figure out how to do it otherwise. Here is the code:

using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using UnityEngine.Events;
using System.Timers;

public class LaunchBall : MonoBehaviour
{

    public Rigidbody rb;
    public float forceOnBall;
    public float percentage = 0;
    public bool buttonPressed = false;
    public int sign = 1;

    /* void OnMouseDown()
     {
         GetComponent<Rigidbody>().AddForce(transform.right * 500);
         GetComponent<Rigidbody>().useGravity = true;          
     }  */    

    void Start()
    {
        rb = GetComponent<Rigidbody>();
    }
     
    public void ButtonDown()
    {
        buttonPressed = true;
    }

    public void ButtonUp()
    {
        buttonPressed = false;       
    }

    public void Update()
    {
        if (buttonPressed)
        {
            percentage+=sign;
            Debug.Log(percentage);

            if (percentage == 100 || percentage == 0)
                sign *= -1;
        }  
    }

    public void HitBall()
    {
        forceOnBall = percentage * 100;

        if (!buttonPressed && percentage > 0)
        {
            rb.AddForce(0, 0, forceOnBall, ForceMode.Impulse);  
        }
    }
}

Here is a fixed code that calls the HItBall method:

public class LaunchBall : MonoBehaviour
{
    public float force = 1;

    private Rigidbody rb;
    private float forceOnBall;
    private float percentage = 0;
    private bool buttonPressed = false;
    private int sign = 1;

    private void Start()
    {
        rb = GetComponent<Rigidbody>();
    }

    public void Update()
    {
        if (Input.GetButton("Fire1"))
        {
            percentage += sign;
            Debug.Log(percentage);

            if (percentage == 100 || percentage == 0)
                sign *= -1;
        }

        if (Input.GetButtonUp("Fire1"))
        {
            HitBall();
        }
    }

    public void HitBall()
    {
        forceOnBall = percentage * force;

        if (percentage > 0)
        {
            rb.AddForce(0, 0, forceOnBall, ForceMode.Impulse);
        }
    }
}