I’m trying to make script where when uou press the target button,the music mutes.
So my script will be posted down below
local music = game.ReplicatedStorage.CurrentMusic
db = true
script.Parent.MouseButton1Click:Connect(function())
if db == true and music then
db = false
script.Parent.Text = ("Unmute Music")
music.Volume = 0
else
db = true
script.Parent.Text = ("Mute Music")
music.Volume = 0.5
end
end)
Move current music from ReplicatedStorage to workspace because sounds may not work there
local music = game:GetService("Workspace"):WaitForChild("CurrentMusic")
db = true
script.Parent.MouseButton1Click:Connect(function()
if db == true then
db = false
script.Parent.Text = ("Unmute Music")
music.Volume = 0
else
db = true
script.Parent.Text = ("Mute Music")
music.Volume = 0.5
end
end)