Script skips half of the sentences

Hi, I have a script to controll dialogues, but I found that for some reason it will skipt half of the sentences. For example, if I have 5 (0-4) sentences it will only show the sentences 0,2 and 4.
Does anybody know why this happends?
Thanks

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

public class DialogueManager : MonoBehaviour
{
    public TMP_Text nameText;
    public TMP_Text dialogueText;
    public Animator animator;

    private Queue<string> sentences;

    public float timeForSentece = 5f;

    // Start is called before the first frame update
    void Start()
    {
        sentences = new Queue<string>();
    }

    public void StartDialogue (Dialogue dialogue)
    {
        animator.SetBool("isOpen", true);

        nameText.text = dialogue.personName;

        sentences.Clear();

        foreach (string sentence in dialogue.sentences)
        {
            sentences.Enqueue(sentence);
        }

        StartCoroutine(ChangeSentece(dialogue));
    }

    public void DisplayNextSentece()
    {
        if (sentences.Count == 0)
        {
            EndDialogue();
            return;
        }

        string sentence = sentences.Dequeue();
        dialogueText.text = sentence;
    }

    IEnumerator ChangeSentece(Dialogue dialogue)
    {
        DisplayNextSentece();

        foreach (string sentence in dialogue.sentences)
        {
            yield return new WaitForSeconds(timeForSentece);
            DisplayNextSentece();
        }

        if (sentences.Count == 0)
        {
            yield return null;
        }
       
    }

    public void EndDialogue()
    {
        animator.SetBool("isOpen", false);
    }
}

I found that if I start the dialogue using a button it works perfectly, whic means that the problem should be on this script (or at least that’s what I think):

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

public class DialogueTrigger : MonoBehaviour
{
    public Dialogue dialogue;

    private void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Cinematic")
        {
            TriggerDialogue();
            Destroy(GameObject.Find("IntroCinematic"));
        }
    }

    public void TriggerDialogue()
    {
        FindObjectOfType<DialogueManager>().StartDialogue(dialogue);
    }
}

My guess is that whatever is triggering your dialogue is causing it to happen twice. You can just add a check to not trigger it if it’s already running.

This thing makes no sense to me:

        DisplayNextSentece();
        foreach (string sentence in dialogue.sentences)
        {
            yield return new WaitForSeconds(timeForSentece);
            DisplayNextSentece();
        }

It should just be something like:

while (sentences.Count > 0) {
  DisplayNextSentence();
  yield return new WaitForSeconds(timeForSentece);
}

But yeah I think RadRedPanda is right - OnTriggerEnter is probably running more than once and you have nothing to prevent multiple coroutines from happening at the same time. A common reason for OnTriggerEnter to run twice is if you have multiple colliders.