I was wondering how you can simply script a key to start a sound looping, but pressing it again to stop it. And also make it not rely on the time you hold it (pressing/holding the key will turn it on, and vice versa).
No code examples for this exact situation unfortunately (maybe we should add some more UI specific ones )
Itâs effectively a toggle button that plays/pauses the sound.
I would have a Boolean variable that stores whether the sound is playing or paused. Listen to the click event on the button and based on Boolean variable, play or resume the sound
@DevPlex01
Is there a better way to activate the boolean âloopâ for the sound string? (see script)
I desire for this to loop when it is to be on, on turn off and not loop when off.
(Not sure if there is a simpler way to do that)
You could try seeing if something like this.entity.sound.loop exists. You can set it to true when you want it to loop and set it to false when you donât want the sound to loop.