Currently, I have a sound system in my game. However, since I have multiple songs for multiple areas and people will always spawn in one certain area, I have to put a line to stop every song so that two songs don't play at the same time.
Currently, my music script works like this:
function onTouched(hit) script.Parent.Parent.PalaceM:stop() script.Parent.Parent.CastleM:stop() script.Parent.Parent.InnM:stop() script.Parent.Parent.GrassM:stop() script.Parent.Parent.CastleM:play() end script.Parent.Touched:connect(onTouched)
Is there any way I could simply make any music end upon death?
btw easier way to stop all sounds i typed this here, so if doesnt work, tell me
local playing = false function onTouched(hit) for i,v in pairs(script.Parent.Parent:GetChildren()) do if v:IsA("Sound") then v:stop() if playing == false then playing = true if v.Name == "Sound" then v:play() end end end end end playing = false script.Parent.Touched:connect(onTouched)