Double click timer Not working

Hi! Before explaining here you have the script.

 bool oneclick = false;
    bool timer;
    float timerdoubleclick;
    float timersingleclick;
    float delay = 0.25f;

    public GameObject Dice4Canvas;

 if (Input.GetMouseButtonDown(0))
            {
                Vector2 worldPoint = Camera.main.ScreenToWorldPoint(Input.mousePosition);
                RaycastHit2D hit = Physics2D.Raycast(worldPoint, Vector2.zero);
                if (hit.collider != null)
                {
                    if (hit.collider.name == "Dice4")
                    {
                        if (!oneclick) // first click no previous clicks
                        {
                            oneclick = true;
    
                            timerdoubleclick = Time.time;
                        }
                        else
                        {
                            oneclick = false;
                            Dice4Canvas.SetActive(true);
                        }
                    }
                    if (oneclick)
                    {
                        timersingleclick = Time.time;
                        if ((Time.time - timerdoubleclick) > delay)
                        {
                            oneclick = false;
    
                        }
                    }
                }
            }

What I want is that if you click 2 times on the object, its canvas appears (the canvas is set false in Start()).
The problem I have is that I click it 2 times, no matter how much time has passed, it allways sets the canvas on true.

Edit: I want that if X time passes it no longer takes into account the first click, so it can be first clicked again.

Please help me.

place this `
if (oneclick)
{
timersingleclick = Time.time;
if ((Time.time - timerdoubleclick) > delay)
{
oneclick = false;

                         }
                     }`

out of if (Input.GetMouseButtonDown(0)){...}