How to fix dialog system looping error 2D unity?

I’m following a tutorial on youtube(UNITY 2D NPC DIALOGUE SYSTEM TUTORIAL - YouTube) on how to make a simple dialogue system that when you collide on the NPC and press E a dialogue box with dialog and a continue button will appear, I changed it a bit; instead of pressing E, I try assigning it on a button because I’m making a mobile game so I make a public void InteractButton(). the problem is instead of displaying the line or sentence it loops and blinks like a Christmas light and it does not show the text properly, if I put Help it shows elpH. what should I do?

here’s the code that I put on NPC

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

public class DialogueManager : MonoBehaviour
{

public string[] dialogue;
private int index;
public GameObject dialoguePanel;
public TextMeshProUGUI dialogueText;
public GameObject continueButton;
public float typingSpeed;
public bool playerIsClose;
public bool isClick;

// Update is called once per frame
void Update()
{
    if (isClick && playerIsClose) 
    {
        if (dialoguePanel.activeInHierarchy) 
        {
            zeroText();
        }
        else 
        {
            dialoguePanel.SetActive(true);
            StartCoroutine(Type());
        }
    }

    if (dialogueText.text == dialogue[index])
    {
        continueButton.SetActive(true);
    }
}

public void zeroText() 
{
    dialogueText.text = "";
    index = 0;
    dialoguePanel.SetActive(false);
}

IEnumerator Type()
{
    foreach (char letter in dialogue[index].ToCharArray())
    {
        dialogueText.text += letter;
        yield return new WaitForSeconds(typingSpeed);
    }
}

public void NextSentence()
{
    continueButton.SetActive(false);
    if (index < dialogue.Length - 1)
    {
        index++;
        dialogueText.text = "";
        StartCoroutine(Type());
    }
    else
    {
        zeroText();
    }
}

public void InteractButton() 
{
    isClick = true;
}

private void OnTriggerEnter2D(Collider2D other)
{
    if (other.CompareTag("Player")) 
    {
        playerIsClose = true;
    }
}

private void OnTriggerExit2D(Collider2D other)
{
    if (other.CompareTag("Player"))
    {
        playerIsClose = false;
        zeroText();
    }
}

}

// Update is called once per frame
void Update()
{
}

 public void InteractButton() 
 {
     if (playerIsClose) 
     {
         if (dialoguePanel.activeInHierarchy) 
         {
             zeroText();
         }
         else 
         {
             dialoguePanel.SetActive(true);
             StartCoroutine(Type());
         }
     }
 }

 IEnumerator Type()
 {
     WaitForSeconds wait = new WaitForSeconds(typingSpeed);
     foreach (char letter in dialogue[index].ToCharArray())
     {
         dialogueText.text += letter;
         yield return wait;
     }
     continueButton.SetActive(true);
 }