Need help for 2 script,

First script :
i use this script to decrease a counter and reset it when it reach maxvalue

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

public class NumberTextDecreaser : MonoBehaviour
{
public int maxValue;
public TextMeshProUGUI numberText;
int counter;

public void ButoonPressed()
{
    if (counter <= maxValue) counter = 31;
    counter--;
    numberText.text = counter + "";

}

}

what i need is : that the second button decrease between counter and maxvalue. The counter is decreased by a first on button click.

Second script :

A textmeshpro with is increased by a onclick button, and a second onclick button that decrease a counter.
when the counter reach maxvalue, the textmeshpro reset to 0.

I hope i was clear and thanks for the answers.,