I have a region based music script and don’t know why when I press mute button and die the music will turn back on… I’m thinking of removing all kill bricks but if you guys know a better way.
also how would I be able to add sound fading?
I know about I 1,50 for sound.volume -1 but when I tried to add it to the stop() part couldn’t get it to work…
(just read about Resetgui on death its already flipped off, not working.)
script in question
local soundregionworkspace = game.Workspace:WaitForChild("SoundRegions")
local Found = false
while wait(1) do
for i, v in pairs(soundregionworkspace:GetChildren()) do
Found = false
local region = Region3.new(v.Position - (v.Size/2),v.Position + (v.Size/2))
local part = game.Workspace:FindPartsInRegion3WithWhiteList(region, game.Players.LocalPlayer.Character:GetDescendants())
for _, part in pairs(part) do
if part:FindFirstAncestor(game.Players.LocalPlayer.Name) then
Found = true
break
else
Found = false
end
end
if Found == true then
if script.Parent.RegionSongs[v.Name].IsPlaying == false then
script.Parent.RegionSongs[v.Name]:Play()
break
end
else
script.Parent.RegionSongs[v.Name]:Stop()
end
end
end
and
local music = {'troll'}
local db = true
script.Parent.MouseButton1Click:Connect(function()
if db == true and music then
db = false
script.Parent.MUTE.Text = ("UNMUTE")
script.Parent.Parent.Parent.Parent.SongAreas.Disabled = true
script.Parent.Parent.Parent.Parent.RegionSongs.LobbySong.Playing = false
script.Parent.Parent.Parent.Parent.RegionSongs.bonus1.Playing = false
script.Parent.Parent.Parent.Parent.RegionSongs.bonus2.Playing = false
script.Parent.Parent.Parent.Parent.RegionSongs.bonus3.Playing = false
script.Parent.Parent.Parent.Parent.RegionSongs.bonus4.Playing = false
script.Parent.Parent.Parent.Parent.RegionSongs.bonus5.Playing = false
script.Parent.Parent.Parent.Parent.RegionSongs.bosslvl1.Playing = false
script.Parent.Parent.Parent.Parent.RegionSongs.bosslvl2.Playing = false
script.Parent.Parent.Parent.Parent.RegionSongs.bosslvl3.Playing = false
script.Parent.Parent.Parent.Parent.RegionSongs.bosslvl4.Playing = false
script.Parent.Parent.Parent.Parent.RegionSongs.bosslvl5.Playing = false
script.Parent.Parent.Parent.Parent.RegionSongs.Stage1Song.Playing = false
script.Parent.Parent.Parent.Parent.RegionSongs.Stage2Song.Playing = false
script.Parent.Parent.Parent.Parent.RegionSongs.Stage3Song.Playing = false
script.Parent.Parent.Parent.Parent.RegionSongs.Stage4Song.Playing = false
script.Parent.Parent.Parent.Parent.RegionSongs.Stage5Song.Playing = false
script.Parent.Parent.Parent.Parent.RegionSongs.Stage6Song.Playing = false
script.Parent.Parent.Parent.Parent.RegionSongs.Stage7Song.Playing = false
script.Parent.Parent.Parent.Parent.RegionSongs.Stage8Song.Playing = false
script.Parent.Parent.Parent.Parent.RegionSongs.Stage9Song.Playing = false
script.Parent.Parent.Parent.Parent.RegionSongs.Stage10Song.Playing = false
script.Parent.Parent.Parent.Parent.RegionSongs.Stage11Song.Playing = false
script.Parent.Parent.Parent.Parent.RegionSongs.Stage12Song.Playing = false
script.Parent.Parent.Parent.Parent.RegionSongs.Stage13Song.Playing = false
script.Parent.Parent.Parent.Parent.RegionSongs.Stage14Song.Playing = false
script.Parent.Parent.Parent.Parent.RegionSongs.Stage15Song.Playing = false
else
db = true
script.Parent.MUTE.Text = ("MUTE")
script.Parent.Parent.Parent.Parent.SongAreas.Disabled = false
end
end)