Game pause but code keeps executing

just like the title says im super confused how the heck do i stop the code in the game level map from executing

i have event being play on the level map BP
it opens up a ui widget, i set the game to pause until the ui widget is done (the ui widget is there to type text to player)
once the ui widget is done typeing i set game pause to false
during which time the event begin play is supposed to continue running some code

what is happening is the event being play runs all the code to the end without waiting,
i have tried game pause in the event begin play but that doesnt do any good,

how the heck do you stop a function from executing am i missing something?

Also i tried doing a loop function to keep checking for a true back from the ui, but i get a infinite loop error.

are you setting the global time dilation? generally you cant access / affect code running in the level bp, better to move that code if you need to access it

then you could use set custom time dilation to 0

Well it was as easy as adding a timeline and a delay, once the game is paused the timeline also paused and the small delay of .1 gives enough time to keep the code from running to the end before the widget is done typing the text, ill probably find a more elegant way to do this in the future but for now i can live with the solution lol