Discuss Scratch

cheKeRzz81
Scratcher
3 posts

How do I make my music fully stop?

I'm currently trying to make this game with music, and when you go into a different level, the music before stops and the new music plays. However, after a certain period of time, the music before plays. I want the music to repeat in the level until you exit it, and for the script to stop playing the music, but even with the “stop this script” button, it doesn't stop and the music continues to play. How do I fix this?
TeoProot
Scratcher
100+ posts

How do I make my music fully stop?

Do this:
when I receive [LevelChange v]
forever
play sound [(join [Level_] (level)) v] until done
end
Keep in mind that you have to brodcast a LevelChange at the start of the game, and that your music has to be called Level_1 (Or Level_2, or whatever level you are making music for)
cheKeRzz81
Scratcher
3 posts

How do I make my music fully stop?

That did work, but when I go to a different level, to make the script that ran the music in the first stage stop, do I put a “if ___ then” thing to stop the script so that the other music cant override it?
cheKeRzz81
Scratcher
3 posts

How do I make my music fully stop?

I have it to where the music repeats until the target touches the win thing, and if it receives level change, it stops all sounds.however, it doesn't stop all sounds and it doesn't stop repeating even after it touches the win thing.

Last edited by cheKeRzz81 (Feb. 10, 2026 19:26:03)

blackcow29
Scratcher
500+ posts

How do I make my music fully stop?

The best way to do this would probably be to have the sprite for the first area play its music, then when you go to the next area, have the first area’s sprite mute its music (set its volume to 0,) then when you go back to the first area, just set its volume back to 100. You’ll have to do something similar with the second area. The music from the first area will still be playing, but you won’t be able to hear it, so that when you go back to it, it’ll continue from where its currently at.
kansea
Scratcher
500+ posts

How do I make my music fully stop?

One thing I've begun to use occasionally is a clone to handle the actual playing.

One sprite that controls the audio. When that sprite receives a broadcast to play music, instead of playing the music itself, it creates a clone. When I start as a clone, forever (play sound until done). To stop the audio, you can simply delete the clone. There are a couple ways of doing this, but I like to set a separate broadcast message to stop the audio. That broadcast receiver just runs “delete this clone”.

Powered by DjangoBB