UI button getting registered twice

Hi, i am making a game and sometimes when i click on a button, it gets registered twice. Once on mouse down and once on mouse up.

Please show your code so we can see what it looks like.

Its just the default Tmp button, but here’s the code

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
using UnityEngine.UI;
public class UkolController : MonoBehaviour
{

    public static bool doingUkols;

    [SerializeField]
    private GameObject image;

    [SerializeField]
    private string[] questions;

    [SerializeField]
    private bool[] Answers;

    [SerializeField]
    private TMP_Text text;

    private bool yourAnswer;

    [SerializeField]
    private int questionDoing;

    private int questionOn;

    [SerializeField]
    private GameObject[] answersImages;

    [SerializeField]
    private Sprite tick;

    [SerializeField]
    private Sprite cross;
    private void Start()
    {
        doingUkols = false;
    }

    public void StartNewUkol()
    {
        questionOn = 1;
        Cursor.lockState = CursorLockMode.Confined;
        image.SetActive(true);
        doingUkols = true;

        questionDoing = Random.Range(0, questions.Length);

        text.text = questions[questionDoing];
    }

    void Answer()
    {
        if(questionOn == 3)
        {
            image.SetActive(false);

            answersImages[0].SetActive(false);
            answersImages[1].SetActive(false);
            answersImages[2].SetActive(false);

            doingUkols = false;
        }


        if(Answers[questionDoing] == yourAnswer)
        {
            answersImages[questionOn - 1].SetActive(true);

            answersImages[questionOn - 1].GetComponent<Image>().sprite = tick;

            NextUkol();
        }
        else
        {
            answersImages[questionOn - 1].SetActive(true);

            answersImages[questionOn - 1].GetComponent<Image>().sprite = cross;

            NextUkol();
        }
    }

    void NextUkol()
    {
        questionOn += 1;
        questionDoing = Random.Range(0, questions.Length);
        text.text = questions[questionDoing];
    }

    public void Y()
    {
        yourAnswer = true;

        Answer();
    }

    public void I()
    {
        yourAnswer = false;
        Answer();
    }
}