How do I make 2 buttons do the same thing with 1 script?

I’m new to Unity and i wanna make a 2D clicker game where you can press the X or the Z (or spam them) buttons to get points. I don’t really know what to do cause when I attach them in Unity only the X button works. The Z does nothing. This is my code so far:

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

public class ButtonClick : MonoBehaviour
{
    public int PPPerClick = 1;
    public int PP = 0;
    public Text PPDisplay;

    void Update()
    {
        PPDisplay.text = "PP: " + PP;
    }


    public void OnXButtonClick()
    {
       PP += PPPerClick;


    }
    public void OnZButtonClick()
    {
        PP += PPPerClick;


    }
}

You can go the other way and make things easier:

using UnityEngine;
using UnityEngine.UI;

public class TEST : MonoBehaviour
{
    public Text PPDisplay;
    public Button buttonX, buttonZ;
    public int PPPerClick = 1;
    int PP, PPCh;

    void Awake()
    {
        buttonX.onClick.AddListener(PushTheButton);
        buttonZ.onClick.AddListener(PushTheButton);
    }

    void Update()
    {
        if (PP != PPCh)
        {
            PPDisplay.text = "PP: " + PP;
            PPCh = PP; // Minor optimization.
        }
    }    

    void PushTheButton()
    {
        PP += PPPerClick;
        print("pressed the button");
    }
}