Hi Xisco, thanks for the suggestion.
I should have known it would be so simple, this is GDev!
I ended up doing it slightly differently, I just wanted all the sounds either on or off. For those who might be interested, the code I used is below.
I chose the X key and set it up to toggle. Basically the variable is used to check if the sound is on or off, if it’s off turn it on, and vice versa. The timer is needed because key presses are checked very rapidly, and the toggle would happen too quickly to be useful.
I’ve only been using GDev for a short while, so this might not be the best way of doing it, but if anyone wants to use this you’re welcome.