local V=settings.DisplayMuteButton local L=true function CreateButton()local V=script.MuteButton:clone()script.MuteButton:Destroy()V.Visible=true V.MouseButton1Click:connect(function()L=not L local V=script:FindFirstChild("\066\071\077")if V then V.Volume=L and V.OriginalVolume.Value or 0 end end)V.Parent=(plr:WaitForChild("\080\108\097\121\101\114\071\117\105")).PlayerHud.PlayerHUD.Settings.Content.Music end function CharInit()char=plr.Character torso=char:WaitForChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")if V then CreateButton()end end if plr.Character and plr.Character.Parent~=nil then CharInit()end plr.CharacterAdded:connect(function()CharInit()end)
--mute button stuff
local canmute = settings.DisplayMuteButton

local musicon = true

function CreateButton()
	local button = script.MuteButton:clone()
	script.MuteButton:Destroy()
	button.Visible = true
	button.MouseButton1Click:connect(function()
		musicon = not musicon
		local bgm = script:FindFirstChild("BGM")
		if bgm then
			bgm.Volume = musicon and bgm.OriginalVolume.Value or 0
		end
	end)
	button.Parent = plr:WaitForChild("PlayerGui").PlayerHud.PlayerHUD.Settings.Content.Music
end

function CharInit()
	char = plr.Character
	torso = char:WaitForChild("HumanoidRootPart")
	if canmute then
		CreateButton()
	end
end

if plr.Character and plr.Character.Parent ~= nil then
	CharInit()
end
plr.CharacterAdded:connect(function()
	CharInit()
end)
