[CLOSED] How could I return from my *function* when my sound has finished playing?

Hello. I’m making a dialogue system for my game, and I wanted to play a sound and then return only when the sound finished playing. I tried replicating what another user answered in a similar post, but I couldn’t create a custom event in my function (I read that I couldn’t). How could I adapt that code, or make it work for my function?

BTW, this is my blueprint for the function:

And this is where I got stuck:

You can’t put time dependent things inside functions, as you’ve discovered :wink:

But you can parameterize custom events. And then really, what is the different between that and a function?

In general, you should structure your dialog system as a state machine with current state, and transition events.
The transition events can of course be implemented in functions.

Somewhat unpopular but correct observation: You should in general never use “Delay.” It feels convenient for many things, but it frequently ends up causing bugs that are hard to debug as your game logic scales up.