-- aqui detectamos cuando clickeamos el boton

muteBtn.MouseButton1Click:Connect(function()
	visibleIcon = not visibleIcon
	muteIcon.Visible = visibleIcon
	local sound = game.SoundService:FindFirstChild("Sound")
	
	if visibleIcon and sound then
		sound.Volume = 0
	elseif not visibleIcon and sound then
		sound.Volume = 0.5
	end
end)

while wait() do
	for i,s in pairs(game.SoundService:GetChildren())do
		s:Destroy()
	end
	
	local random = math.random(1, #musicFolder:GetChildren())
	local sound = musicFolder:GetChildren()[random]
	local soundClone = sound:Clone()
	
	showMusic(musicGui, sound.Name)	
	soundClone.Name = "Sound"
	soundClone.Parent = game.SoundService
	soundClone:Play()
	soundClone.Ended:Wait()
	soundClone:Destroy()
end
