Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How do I play random music after a sound effect?
- Eld4n79
-
20 posts
How do I play random music after a sound effect?
Recently. I’ve been making a outro for my grounded projects, after the credits sound plays it switches to a random song, but sometimes it chooses that credits noise. How do I tell the code to choose the music only?
Here is my code:
If you can, please attach a link to the project that can load music.
Here is my code:
If you can, please attach a link to the project that can load music.

- KralEjder65
-
48 posts
How do I play random music after a sound effect?
I think it works with this:
Last edited by KralEjder65 (Sept. 14, 2023 16:47:10)
- KralEjder65
-
48 posts
How do I play random music after a sound effect?
In your code its always playing a random music and it has no cooldown.So i fixed it
- RecessFailsOffical
-
1000+ posts
How do I play random music after a sound effect?
THE EXPLANATION:
Say you have 15 songs (including credits) in your project. In the menu, place the credits as the last sound. Then, you can add a pick random 1 through 14 so it doesn't have a chance to play the credits song.
THE SOLUTION:
In your backdrop sprite, include this:
I hope this helps!
Say you have 15 songs (including credits) in your project. In the menu, place the credits as the last sound. Then, you can add a pick random 1 through 14 so it doesn't have a chance to play the credits song.
THE SOLUTION:
In your backdrop sprite, include this:
I hope this helps!
- Discussion Forums
- » Help with Scripts
-
» How do I play random music after a sound effect?