I’m trying to make some towers for the game “Juke’s Towers of Hell” and their built-in music system isn’t working, so I’m making it myself. I’m trying to make so when you die ALL music turns off and I don’t want to make the scripts for every single music in the game. I was wondering if there was a way to turn off any/all playing music at once.
2 Likes
You can loop through where your music is stored like this: (you set the music variable to the correct area)
local musicFolder = game.ReplicatedStorage.Music
for _, v in pairs(musicFolder:GetChildren()) do
v:Stop() --stops all playing music
end
Sorry if I misunderstood…
5 Likes
If your music is all in the same place, then you can use an in pairs loop do stop all music like this:
for i, music in pairs(musicFolder:GetChildren()) do
if music:IsA(“Sound”) then
music:Stop()
end
end
I’m not entirely sure if this script will work and it can only be used if you have all your sounds in a folder
1 Like