Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

This music playing script isn't working, what is the problem with it?

local function songs ()
	game.Workspace.Songs.DarudeSand:Play()
	wait(123)
	game.Workspace.Songs.Bangarang:Play()
	wait(94)
	game.Workspace.Songs.ET:Play()
	wait(119)
	game.Workspace.Songs.Poison:Play()
end

songs()


script.Parent.Parent.StarterGui.ShopAct.Frame.ImageButton.MouseButton1Click:Connect(function()
	if game.Workspace.Songs ~= nil then
		game.Workspace.Songs:Destroy()
	elseif game.Workspace.Songs == nil then
		game.ReplicatedStorage.Songs:Clone(workspace)
		songs()
		
	end

end)

It plays the music but whenever I want to mute it, It doesn't work at all.

2 comments

0

Use game.Workspace.Songs.Songname:Stop()

1

That is actually incorrect, if you want to mute it, you would just set the volume to 0.

1 answer

✓ Accepted answer

I'm assuming you destroying and cloning the songs again is what you were doing to "mute" the songs, but it's a whole lot easier than you realize.

local function songs()
    game.Workspace.Songs.DarudeSand:Play()
    wait(123)
    game.Workspace.Songs.Bangarang:Play()
    wait(94)
    game.Workspace.Songs.ET:Play()
    wait(119)
    game.Workspace.Songs.Poison:Play()
end

--do this below or you can do it individually, I'm only placing it in a function so it is easier to understand
local isMuted = false
local function mute()
    game.Workspace.Songs.DarudeSand.Volume=0
    game.Workspace.Songs.Bangarang.Volume=0
    game.Workspace.Songs.ET.Volume=0
    game.Workspace.Songs.Poison.Volume=0
    isMuted = true
end

local function resume()
    game.Workspace.Songs.DarudeSand.Volume=1 --volume can be 0-10, but you can play with the settings depending on the song, even can add reverb to them too.
    game.Workspace.Songs.Bangarang.Volume=1
    game.Workspace.Songs.ET.Volume=1
    game.Workspace.Songs.Poison.Volume=1
    isMuted = false
end

songs()


script.Parent.Parent.StarterGui.ShopAct.Frame.ImageButton.MouseButton1Click:Connect(function()
    if isMuted = false then
        mute()
    else
        resume()
    end
end)

So you actually don't have any code here that mutes it, is why it is never being muted. What you were doing before was completely stopping the music by destroying it. This way, you can mute it, and unmute it, and it will continue playing even as it's muted.

Also I said you could add reverb to sounds, and to do that you right click the sound and insert object, and then you can add sound effects which each have additional properties you can mess around with.

This discussion is preserved as it was. New answers, comments, and votes are closed.