music
What function do you use to stop your music? I'm using audio.stopMusic("level1") but it's not working
What function do you use to stop your music? I'm using audio.stopMusic("level1") but it's not working
That's not how it works, first, you should note that audio.playMusic("level1") plays the music automatically, but it also returns an object, because if you use it on the console, it will return the following
object
play = [native function]
stop = [native function]
setVolume = [native function]
getPosition = [native function]
getDuration = [native function]
setPosition = [native function]
end
And you can see that the stop function is located there. In summary, the object controls the sound you just played, so you'll need to name it with a variable, so that you can call it later, and tell the object to stop the sound
my_music = audio.playMusic("level1")
my_music.stop()
So if you're going to use music, I recommend always naming it with a variable, so you can control or reset it
thank y