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










