TextMeshPro

Hi I have a doubt on coding
In my project I’m using TMP text for display score in-game there is 2 button in-game if I press button 1 score have to increase 10 if i press button 2 score have to increase 20 how to implement that

Something like this should work. I haven’t tested it or anything so there may be mistakes but its the right idea.

public class Button1 : Monobehaviour
{
    private void OnClick() 
    {
        Text.ChangeScoreByTen();
    }
}
public class Button2 : Monobehaviour
{
    private void OnClick()
    {
        Text.ChangeScoreByTwenty();
    }
}
public class TextMeshProThingy : Monobehaviour
{
    [SerializeField] private TextMeshProUGUI tmp;
    private int score;

    private void Update()
    {
        tmp.text = ToString(score);
    }

    public static void ChangeScoreByTen()
    {
        score += 10;
    }
     public static void ChangeScoreByTwenty()
    {
        score += 20;
    }
}