While Loop sound cue crashes game

Okay, so I am trying to loop a sound until the event is over. So far I have tried doing this, however this crashes the game when I press E. Can someone help me keep playing the sound until the event is over. Also, when I press E again, it should stop playing the sound. Can you please show me how to do this?
Thanks in advance
Imgur

Create a new Actor and add an Audio component to it. Then you can reference the actor. And stop the sound by destroying the actor from the scene.

About the While loops. You’re miss using it. The while loop runs until its true. In your case your while loop is endless and it will never complete. The engine will not call an another Key press Event because its stuck in the While loop.

Thanks Azarus.
I can’t attach it to an actor and destroy it, because then it can never be used again. In my case, this is a heartbeat sound effect that must occur every time the player presses E. Since the audio component is only one heartbeat, I need it to keep looping until the player toggles E off again. Can you please help me with that?

Then Add an audio component to the player character and start / stop the sound when it needs to be played. It is that simple.

Thank you mate!