BTW I fixed it, here's the fixed version for reference:
func UpdateUI():
if curent_node_id >= 0:
if current_node_affect > 0:
AffectRecognition()
dialoguePanel.show()
for x in dialogueButtons:
x.hide()
#disconnect buttons
if x.is_connected("pressed",self,"_on_Button_Pressed"):
x.disconnect("pressed",self,"_on_Button_Pressed")
Thankyou, I love your code :)