local h=game:GetService("\080\108\097\121\101\114\115")local k=script.Parent local W=k:WaitForChild("\082\101\109\111\116\101")local w=h.LocalPlayer local Z=w:WaitForChild("\080\108\097\121\101\114\071\117\105")local K local s local j=false function Action()if not K then local h=W:InvokeServer("\065\099\116\105\118\097\116\101")if h then ChooseSong()end else Unequip()end end function Unequip()if s then s:Disconnect()s=nil end if K then K:Destroy()K=nil end end function Equip(h)Unequip()h.Button1Down:Connect(Action)end function ChooseSong()if Z:FindFirstChild("\067\104\111\111\115\101\083\111\110\103\071\117\105")then return end local h=Instance.new("\083\099\114\101\101\110\071\117\105")h.Name="\067\104\111\111\115\101\083\111\110\103\071\117\105"local k=Instance.new("\070\114\097\109\101")k.Style=Enum.FrameStyle.RobloxRound k.Size=UDim2.new(.25,0,.25,0)k.AnchorPoint=Vector2.new(.5,.5)k.Active=true k.Draggable=true k.Position=UDim2.new(.5,0,.5,0)k.Parent=h local w=Instance.new("\084\101\120\116\076\097\098\101\108")w.BackgroundTransparency=1 w.TextColor3=Color3.new(1,1,1)w.Font=Enum.Font.SourceSansBold w.TextStrokeTransparency=.75 w.TextScaled=true w.Size=UDim2.new(1,0,.5,0)w.Text="\080\117\116 \105\110 \116\104\101 \073\068 \110\117\109\098\101\114 \102\111\114 \097 \115\111\110\103 \116\104\097\116\'\115 \098\101\101\110 \117\112\108\111\097\100\101\100 \116\111 \082\079\066\076\079\088\046\n\076\101\097\118\101 \105\116 \098\108\097\110\107 \116\111 \115\116\111\112 \112\108\097\121\105\110\103 \109\117\115\105\099\046"w.Parent=k local R=Instance.new("\084\101\120\116\066\111\120")R.BackgroundColor3=Color3.new(0,0,0)R.BackgroundTransparency=.5 R.BorderColor3=Color3.new(1,1,1)R.TextColor3=Color3.new(1,1,1)R.Font=Enum.Font.SourceSansBold R.TextStrokeTransparency=.75 R.TextScaled=true R.Size=UDim2.new(1,0,.2,0)R.Position=UDim2.new(0,0,.5,0)R.Text="\073\068"R.Parent=k local C=Instance.new("\084\101\120\116\066\117\116\116\111\110")C.Style=Enum.ButtonStyle.RobloxButton C.AnchorPoint=Vector2.new(.5,.5)C.TextColor3=Color3.new(1,1,1)C.Font=Enum.Font.SourceSansBold C.TextStrokeTransparency=.75 C.TextScaled=true C.Size=UDim2.new(.75,0,.3,0)C.Position=UDim2.new(.5,0,.85,0)C.Text=j and"\083\116\111\112"or not j and"\080\108\097\121\033"C.Parent=k s=C.MouseButton1Click:Connect(function()if j then j=false C.Text=j and"\083\116\111\112"or not j and"\080\108\097\121\033"W:InvokeServer("\080\108\097\121\083\111\110\103",R.Text,true)return end local k=W:InvokeServer("\080\108\097\121\083\111\110\103",R.Text,j)if k=="\083\117\099\099\101\115\115"then j=true h:Destroy()else w.Text=k delay(1.5,function()if w.Text==k then w.Text="\080\117\116 \105\110 \116\104\101 \073\068 \110\117\109\098\101\114 \102\111\114 \097 \115\111\110\103 \116\104\097\116\'\115 \098\101\101\110 \117\112\108\111\097\100\101\100 \116\111 \082\079\066\076\079\088\046\n\076\101\097\118\101 \105\116 \098\108\097\110\107 \116\111 \115\116\111\112 \112\108\097\121\105\110\103 \109\117\115\105\099\046"end end)end end)h.Parent=Z K=h end k.Equipped:Connect(Equip)k.Unequipped:Connect(Unequip)


local	Players					=	game:GetService("Players")

local	Tool					=	script.Parent
local	Remote					=	Tool:WaitForChild("Remote")

local	Plr						=	Players.LocalPlayer
local	PlrGui					=	Plr:WaitForChild("PlayerGui")

local	Gui
local	Func

local	Playing					=	false

function Action()
	if not Gui then
		local Response = Remote:InvokeServer("Activate")
		if Response then
			ChooseSong()
		end
	else
		Unequip()
	end
end

function Unequip()
	if Func then
		Func:Disconnect()
		Func = nil
	end
	
	if Gui then
		Gui:Destroy()
		Gui = nil
	end
end

function Equip(Mouse)
	Unequip()
	
	Mouse.Button1Down:Connect(Action)
end

function ChooseSong()
	if PlrGui:FindFirstChild("ChooseSongGui") then
		return
	end
	
	local SG = Instance.new("ScreenGui")
	SG.Name = "ChooseSongGui"
	
	local Frame = Instance.new("Frame")
	Frame.Style = Enum.FrameStyle.RobloxRound
	Frame.Size = UDim2.new(.25, 0, .25, 0)
	Frame.AnchorPoint = Vector2.new(.5, .5)
	Frame.Active = true
	Frame.Draggable = true
	Frame.Position = UDim2.new(.5, 0, .5, 0)
	Frame.Parent = SG
	
	local Text = Instance.new("TextLabel")
	Text.BackgroundTransparency = 1
	Text.TextColor3 = Color3.new(1, 1, 1)
	Text.Font = Enum.Font.SourceSansBold
	Text.TextStrokeTransparency = .75
	Text.TextScaled = true
	Text.Size = UDim2.new(1, 0, .5, 0)
	Text.Text = "Put in the ID number for a song that's been uploaded to ROBLOX.\nLeave it blank to stop playing music."
	Text.Parent = Frame
	
	local Input = Instance.new("TextBox")
	Input.BackgroundColor3 = Color3.new(0, 0, 0)
	Input.BackgroundTransparency = .5
	Input.BorderColor3 = Color3.new(1, 1, 1)
	Input.TextColor3 = Color3.new(1, 1, 1)
	Input.Font = Enum.Font.SourceSansBold
	Input.TextStrokeTransparency = .75
	Input.TextScaled = true
	Input.Size = UDim2.new(1, 0, .2, 0)
	Input.Position = UDim2.new(0, 0, .5, 0)
	Input.Text = "ID"
	Input.Parent = Frame
	
	local Button = Instance.new("TextButton")
	Button.Style = Enum.ButtonStyle.RobloxButton
	Button.AnchorPoint = Vector2.new(.5, .5)
	Button.TextColor3 = Color3.new(1, 1, 1)
	Button.Font = Enum.Font.SourceSansBold
	Button.TextStrokeTransparency = .75
	Button.TextScaled = true
	Button.Size = UDim2.new(.75, 0, .3, 0)
	Button.Position = UDim2.new(.5, 0, .85, 0)
	Button.Text = Playing and "Stop" or not Playing and "Play!"
	Button.Parent = Frame
	
	Func = Button.MouseButton1Click:Connect(function()
		if Playing then
			Playing = false
			Button.Text = Playing and "Stop" or not Playing and "Play!"
			Remote:InvokeServer("PlaySong", Input.Text, true)
			return
		end
		
		local Response = Remote:InvokeServer("PlaySong", Input.Text, Playing)
		if Response == "Success" then
			Playing = true
			SG:Destroy()
		else
			Text.Text = Response
			delay(1.5, function()
				if Text.Text == Response then
					Text.Text = "Put in the ID number for a song that's been uploaded to ROBLOX.\nLeave it blank to stop playing music."
				end
			end)
		end
	end)
	
	SG.Parent = PlrGui
	
	Gui = SG
end

Tool.Equipped:Connect(Equip)
Tool.Unequipped:Connect(Unequip)
