Have you tried searching on how to make a music playlist and stuff like that on the devforums?
If you havent (which you should) I think this tutorial might help you.
Suggestion, post some code, nobody knows how your script works so they will likely not be able to help. Don’t assume everyone will watch the tutorial video that you followed.
local button = script.Parent
local musicFolder = workspace.SoundPlaylist
local mute = false
button.MouseButton1Click:Connect(function()
for i,v in pairs(musicFolder:GetChildren()) do
if not v:IsA("Sound") then continue end
if mute then
v.Volume = 0.5 --Or whatever the original volume is
else
v.Volume = 0
end
end
mute = not mute
end)
This code will loop through all the sounds in the folder and sets them to hae a volume of 0.5 or 0 depending on the mute variable, and then at the end, inverts the variable so if it was false, it becomes true and vice versa
local Button = -- Define button
local Music = -- Define music
local Music2 = -- Define other music
local function muteMusic(actionName, inputState, inputObj)
if Music.Volume == 0 then
Music.Volume = 0.5
else
Music.Volume = 0
elseif Music2.Volume == 0 then
Music2.Volume = 0.5
else
Music2.Volume = 0
end
end
button.MouseButton1Click:Connect(muteMusic)
-- This should probably work I guess, update it if you want it to work a different way
-- If this doesn't work, just use this part and just replace the sound id once the music ended
local Button = -- Define button
local Music = -- Define music
local function muteMusic(actionName, inputState, inputObj)
if Music.Volume == 0 then
Music.Volume = 0.5
else
Music.Volume = 0
if Music.Ended then
wait(5)
Music.SoundId = "" -- Paste the sound id
end
end
button.MouseButton1Click:Connect(muteMusic)
That would kinda be more work than it should, it’s better to disable all the music when the button is pressed rather than disable only one, like how I did
Again, it’s kinda avoiding the simplest way to go about it which is to set all the of musics’ volumes to 0 when wanting to mute and 0.5 when wanting to unmute
I would do something like… making a localscript and putting in startergui. Adding a screengui to startergui and textbutton inside the screengui then add this code to the local script.
local TextButton = script.Parent.ScreenGui.TextButton
TextButton.MoiseButton1Down:Connect(function())
if not mute then
mute = true
else
mute = false
end
for _,music in ipairs(game.SoundService:GetChildren())
do
if mute then
if music.Playing then
music.Volume = 0
end
end
if not mute then
if music Volume == 0 then
music.Volume = (something greater then 0)
end
end
end)
I’m sorry it’s so disorganized, I’m on my phone.
This script requires all the songs to be placed in game.SoundService