I want to make a music system with different playlists that you can choose and I want to make a mute button, but when you turn on the music, I only want the playlist that was chosen to play. I haven’t scripted the part where you choose the playlist because I am working on the muting system.
Script:
local frame = script.Parent
local music = workspace.Music
local normal = music.Normal
local vibe = music.Vibe
local bass = music.Bass
local musicButton = frame.MusicButton
local nPlay = frame.NormalPlaylist
local vPlay = frame.VibePlaylist
local bPlay = frame.BassPlaylist
local nOn = true
local vOn = false
local bOn = false
local musicOn = true
local green = Color3.new(0, 0.666667, 0)
local red = Color3.new(1, 0, 0)
musicButton.MouseButton1Click:Connect(function()
if musicOn == true then
musicOn = false
musicButton.BackgroundColor3 = red
--Mute Normal
if nOn == true then
nOn = false
for i,v in pairs(normal:GetChildren()) do
if v:IsA("Sound") then
v.Volume = 0
end
end
else
print("Already Muted")
end
--Mute Vibe
if vOn == true then
vOn = false
for i,v in pairs(vibe:GetChildren()) do
if v:IsA("Sound") then
v.Volume = 0
end
end
else
print("Already Muted")
end
--Mute Bass-boosted
if bOn == true then
bOn = false
for i,v in pairs(bass:GetChildren()) do
if v:IsA("Sound") then
v.Volume = 0
end
end
else
print("Already Muted")
end
else
--Unmute Playing ones
musicOn = true
musicButton.BackgroundColor3 = green
if nOn == false then
for i,v in pairs(normal:GetChildren()) do
if v:IsA("Sound") then
v.Volume = 1
end
end
end
if vOn == false then
for i,v in pairs(vibe:GetChildren()) do
if v:IsA("Sound") then
v.Volume = 1
end
end
end
if bOn == false then
for i,v in pairs(bass:GetChildren()) do
if v:IsA("Sound") then
v.Volume = 1
end
end
end
end
end)
The first part works with muting them all because it just sets them all to zero, but the tricky part for me is the unmuting part. I understand what is going wrong but I don’t know how to fix it or how to make only the chosen one to play.
If anyone knows how to achieve my goal, please help me out and reply down below. Happy holidays everyone!