Weird bug with the popup device consuming main screen ui and audio

Verse code with Sleep()

Verse code without Sleep()

Video with sleep()

Video without sleep()

As you can see this is weird for sure and got me scratching my head. The audio issue alone i thought was weird. The ui icons are all in verse running on a loop: 0.3 and everything prints the correct amounts just the ui doesnt vidually update and the audio doesnt play until the popup is either closed or Sleep() is used

When i run the func() to sell the items it activates a condition_button and the audio and Sleep(0.1) per interation of the loop so when i sell 1 item (Top Arrow Sleep) i need Sleep(0.2) - (0.1 doesnt work) for everything to work before showing the popup again. When i sell 5 items i use Sleep(0.6)

After the without Sleep() when you close the popup you get some delay/lag while everything is updating