local function b(b,n)b.MouseLeave:connect(function(b,Q)n.Visible=false end)b.MouseMoved:connect(function(Q,X)n.Label.Text=b.Desc.Value n.Size=UDim2.new(0,10000,0,10000)local P=n.Label.TextBounds.X local J=math.floor(P/500)J=J+1 if J<1 then J=1 end local O=500 if P<500 then O=P end n.Visible=true n.Size=UDim2.new(0,O+5,0,J*20+5)n.Position=UDim2.new(0,Q,0,(X-40)-(J*20+5))end)end return function(n)local Q=n.gTable local X=Q.Object local P=X.Drag local J=X.Drag.Main local O=X.Drag.Close local e=X.Drag.Hide local t=X.Drag.Search local G=X.Drag.Main.ClientTab local f=X.Drag.Main.ServerTab local K=X.Drag.Main.Dragger local m=X.Drag.Main.Client local F=X.Drag.Main.Server local o=X.Drag.Title local x=X.Entry local c=X.Desc local g=0 local y=service.Players.LocalPlayer:GetMouse()local V,z=P.AbsoluteSize.X,J.AbsoluteSize.Y local R=false local a,u=V,z local M=""local function Z()F.Visible=false m.Visible=true G.BackgroundTransparency=0 f.BackgroundTransparency=.5 end local function H()F.Visible=true m.Visible=false G.BackgroundTransparency=.5 f.BackgroundTransparency=0 end local S S=function()local n local Q=service.GetTasks()m:ClearAllChildren()local X=0 for n,Q in pairs(Q)do local P=x:Clone()local J=P.Frame local O=Q:Status()P.Parent=m P.Visible=true P.Desc.Value=Q.Name P.Position=UDim2.new(0,0,0,X*20)J.Text.Text=tostring(Q.Function)J.Status.Text=O if O=="\115\117\115\112\101\110\100\101\100"then J.Resume.Text="\082\101\115\117\109\101"elseif O=="\110\111\114\109\097\108"or O=="\114\117\110\110\105\110\103"then J.Resume.Text="\083\117\115\112\101\110\100"end J.Resume.MouseButton1Down:connect(function()if J.Resume.Text=="\082\101\115\117\109\101"and Q:Status()=="\083\117\115\112\101\110\100\101\100"then Q:Resume()else Q:Pause()end wait(.5)S()end)J.Kill.MouseButton1Down:connect(function()Q:Kill()wait(.5)S()end)J.Stop.MouseButton1Down:connect(function()Q:Stop()wait(.5)S()end)b(P,c)X=X+1 end m.CanvasSize=UDim2.new(0,0,0,g*20)end f.MouseButton1Down:connect(H)G.MouseButton1Down:connect(Z)O.MouseButton1Click:connect(function()P.Draggable=false P:TweenPosition(UDim2.new(P.Position.X.Scale,P.Position.X.Offset,1,0),"\079\117\116","\083\105\110\101",.5,true)wait(.5)Q:Destroy()end)P.BackgroundColor3=J.BackgroundColor3 e.MouseButton1Click:connect(function()if J.Visible then J.Visible=false P.BackgroundTransparency=J.BackgroundTransparency e.Text="\043"else J.Visible=true P.BackgroundTransparency=1 e.Text="-"end end)y.Move:connect(function(b,n)if R then V=a+(K.Position.X.Offset+20)z=u+(K.Position.Y.Offset+20)if V<200 then V=200 end if z<200 then z=200 end P.Size=UDim2.new(0,V,0,30)J.Size=UDim2.new(1,0,0,z)if V<220 then if M==""then M=o.Text end o.Text=""else if M~=""then o.Text=M M=""end end end end)K.DragBegin:connect(function(b)R=true end)K.DragStopped:connect(function(b,n)R=false a=V u=z K.Position=UDim2.new(1,-20,1,-20)end)Q:Ready()while wait(1)do S()end end

local function Expand(ent, point)
	ent.MouseLeave:connect(function(x,y)
		point.Visible = false
	end)
	
	ent.MouseMoved:connect(function(x,y)
		point.Label.Text = ent.Desc.Value
		point.Size = UDim2.new(0, 10000, 0, 10000)
		local bounds = point.Label.TextBounds.X
		local rows = math.floor(bounds/500)
		rows = rows+1
		if rows<1 then rows = 1 end
		local newx = 500
		if bounds<500 then newx = bounds end
		point.Visible = true
		point.Size = UDim2.new(0, newx+5, 0, (rows*20)+5)
		point.Position = UDim2.new(0, x, 0, y-40-((rows*20)+5))
	end)
end


return function(data)
	local gTable = data.gTable
	local gui = gTable.Object
	local drag = gui.Drag
	local Main = gui.Drag.Main
	local Close = gui.Drag.Close
	local Hide = gui.Drag.Hide
	local Search = gui.Drag.Search
	local cTab = gui.Drag.Main.ClientTab
	local sTab = gui.Drag.Main.ServerTab
	local Dragger = gui.Drag.Main.Dragger
	local cFrame = gui.Drag.Main.Client
	local sFrame = gui.Drag.Main.Server
	local Title = gui.Drag.Title
	local Entry = gui.Entry
	local Desc = gui.Desc
	
	local num = 0
	local mouse = service.Players.LocalPlayer:GetMouse()
	local nx,ny = drag.AbsoluteSize.X,Main.AbsoluteSize.Y
	local dragging = false
	local defx,defy = nx,ny
	local topText = ""
	
	local function openClient()
		sFrame.Visible = false
		cFrame.Visible = true
		cTab.BackgroundTransparency = 0
		sTab.BackgroundTransparency = 0.5
	end
	
	local function openServer()
		sFrame.Visible = true
		cFrame.Visible = false
		cTab.BackgroundTransparency = 0.5
		sTab.BackgroundTransparency = 0
	end
	
	local updateLists; updateLists = function()
		local serverTasks --= client.Remote.Get("TaskCommand","GetTasks")
		local clientTasks = service.GetTasks() --service.Threads.Tasks
		--// Unfinished
		cFrame:ClearAllChildren()
		
		local cNum = 0
		for index,task in pairs(clientTasks) do
			local new = Entry:Clone()
			local frame = new.Frame
			local status = task:Status()
			new.Parent = cFrame
			new.Visible = true
			new.Desc.Value = task.Name
			new.Position = UDim2.new(0,0,0,cNum*20)
			frame.Text.Text = tostring(task.Function)
			frame.Status.Text = status
			
			if status == "suspended" then
				frame.Resume.Text = "Resume"
			elseif status == "normal" or status == "running" then
				frame.Resume.Text = "Suspend"
			end
			
			frame.Resume.MouseButton1Down:connect(function()
				if frame.Resume.Text == "Resume" and task:Status() == "Suspended" then
					task:Resume()
				else
					task:Pause()
				end
				wait(0.5)
				updateLists()
			end)
			
			frame.Kill.MouseButton1Down:connect(function()
				task:Kill()
				wait(0.5)
				updateLists()
			end)
			
			frame.Stop.MouseButton1Down:connect(function()
				task:Stop()
				wait(0.5)
				updateLists()
			end)
			
			Expand(new,Desc)
			cNum = cNum+1
		end
		
		cFrame.CanvasSize =  UDim2.new(0, 0, 0, num*20)
	end
	
	sTab.MouseButton1Down:connect(openServer)
	cTab.MouseButton1Down:connect(openClient)
	
	Close.MouseButton1Click:connect(function()
		drag.Draggable = false
		drag:TweenPosition(UDim2.new(drag.Position.X.Scale, drag.Position.X.Offset, 1,0), "Out", "Sine", 0.5, true)
		wait(0.5)
		gTable:Destroy()
	end)

	drag.BackgroundColor3 = Main.BackgroundColor3
	
	Hide.MouseButton1Click:connect(function() 
		if Main.Visible then
			Main.Visible = false
			drag.BackgroundTransparency = Main.BackgroundTransparency
			Hide.Text = "+"
		else
			Main.Visible = true
			drag.BackgroundTransparency = 1
			Hide.Text = "-"
		end
	end)
	
	mouse.Move:connect(function(x,y) 
		if dragging then
			nx=defx+(Dragger.Position.X.Offset+20)
			ny=defy+(Dragger.Position.Y.Offset+20)
			if nx<200 then nx=200 end
			if ny<200 then ny=200 end
			drag.Size=UDim2.new(0, nx, 0, 30) 
			Main.Size=UDim2.new(1, 0, 0, ny)
			if nx<220 then
				if topText=="" then
					topText=Title.Text
				end
				Title.Text=""
			else
				if topText~="" then
					Title.Text=topText
					topText=""
				end
			end
		end
	end)
	
	Dragger.DragBegin:connect(function(init)
		dragging = true
	end)
	
	Dragger.DragStopped:connect(function(x,y)
		dragging = false
		defx = nx
		defy = ny
		Dragger.Position = UDim2.new(1,-20,1,-20)
	end)
	
	gTable:Ready()
	
	while wait(1) do
		updateLists()
	end
end










