how to wait for an animation to finish before continuing the program

when I define my character death animation and launch the main menu, it does not wait for the animation to end and as soon as I die, it goes to the menu. how to wait for the end of the animation before opening the menu?

You could put a Delay node after the death animation, and put it to be as long as you need before the menu is shown.