Help Needed: Dialogue Box Issue in Godot - Button Click vs. _unhandled_input

Godot Version

Godot 4.2

Question

I’ve been working on a game in Godot, and recently have been trying to create dialogue system. I’ve figured out most of the dialogue system, but was using a func _unhandled_input(event) to trigger the start of the dialogue. Now that I’ve sorted everything else, I wanted to change it so the player clicks on a button, and that starts the dialogue.
The button successfully calls the function in my DialogueManager singleton, but for some reason, the dialogue box will not close upon the dialogue finishing, and instead go onto the next dialogue. The issue is that when I initiate the chat with the _unhandled_input, it works fine. I have no idea why this is happening.
Swapping the contents of the two functions around doesn’t change anything. changing the _unhandled_input’s input key doesn’t change anything. In the singleton, I’ve separated the advance_text() function from the _unhandled_input, and call the advancetext() function within the button press, but once again, that doesn’t change anything.
The dialogue manager and the npc script both use an _unhandled_input function, which I thought is where the issue lied. Though at this point I don’t know…
I’ll include all the relevant scripts as pastebin links. Thank you in advanced, I’m really clueless on how to proceed.
Thank you all in advanced, I wouldn’t post here if I hadn’t exhausted all my options. Please feel free to ask questions and ill answer then as soon as possible.
this is the NPC.gd, which contains the button the player clicks on to initiate the dialogue. the two functions at the bottom, func _on_button_pressed(): and func _unhandled_input(event): are the only two relevant functions.

this script is the chatbox.gd script. this is the script attached to the instantiated scene. It controls the letter by letter typing, and it tells the singleton when the line has finished printing.

I’ve had to add the last script to the pastebin of the chatbox.gd pastebin, as i can only post two links.
the scripted linked in the chatbox.gd is the singleton, DialogueManager.gd, which instantiates the chat box scene onto the main scene when called.