Thanks a lot! With a little bit of adjusting I was able to make my sound slowly fade. I adjusted the speed of it fading so that I can spam without the sound coming too late
I used 3 Booleans and (probably I could manage to use only two, I'll try). If space is pressed a Boolean returns true, it plays music, sets another Boolean to false, then sets itself to false. Once space is released it stops the music and makes that other Boolean true. The music space_pressed Boolean can only return true while the other Boolean is also true, preventing it self switching on then off and again and again.
Sent from my iPhone using Tapatalk