local function t(t,s)t.MouseLeave:Connect(function(t,P)s.Visible=false end)t.MouseMoved:Connect(function(P,G)s.Label.Text=t.Desc.Value s.Size=UDim2.new(0,10000,0,10000)local W=s.Label.TextBounds.X local f=math.floor(W/500)f=f+1 if f<1 then f=1 end local g=500 if W<500 then g=W end s.Visible=true s.Size=UDim2.new(0,g+5,0,f*20+5)s.Position=UDim2.new(0,P,0,(G-40)-(f*20+5))end)end return function(s,P)if P then setfenv(1,P)end local G=s.gTable local W=G.Object local f=W.Drag local g=W.Drag.Main local U=W.Drag.Close local B=W.Drag.Hide local a=W.Drag.Search local l=W.Drag.Main.ClientTab local S=W.Drag.Main.ServerTab local R=W.Drag.Main.Dragger local d=W.Drag.Main.Client local h=W.Drag.Main.Server local c=W.Drag.Title local z=W.Entry local Q=W.Desc local j=0 local u=service.Players.LocalPlayer:GetMouse()local I,m=f.AbsoluteSize.X,g.AbsoluteSize.Y local k=false local b,J=I,m local N=""local function q()h.Visible=false d.Visible=true l.BackgroundTransparency=0 S.BackgroundTransparency=.5 end local function D()h.Visible=true d.Visible=false l.BackgroundTransparency=.5 S.BackgroundTransparency=0 end local L L=function()local s local P=service.GetTasks()d:ClearAllChildren()local G=0 for s,P in pairs(P)do local W=z:Clone()local f=W.Frame local g=P:Status()W.Parent=d W.Visible=true W.Desc.Value=P.Name W.Position=UDim2.new(0,0,0,G*20)f.Text.Text=tostring(P.Function)f.Status.Text=g if g=="\115\117\115\112\101\110\100\101\100"then f.Resume.Text="\082\101\115\117\109\101"elseif g=="\110\111\114\109\097\108"or g=="\114\117\110\110\105\110\103"then f.Resume.Text="\083\117\115\112\101\110\100"end f.Resume.MouseButton1Down:Connect(function()if f.Resume.Text=="\082\101\115\117\109\101"and P:Status()=="\083\117\115\112\101\110\100\101\100"then P:Resume()else P:Pause()end wait(.5)L()end)f.Kill.MouseButton1Down:Connect(function()P:Kill()wait(.5)L()end)f.Stop.MouseButton1Down:Connect(function()P:Stop()wait(.5)L()end)t(W,Q)G=G+1 end d.CanvasSize=UDim2.new(0,0,0,j*20)end S.MouseButton1Down:Connect(D)l.MouseButton1Down:Connect(q)U.MouseButton1Click:Connect(function()f.Draggable=false f:TweenPosition(UDim2.new(f.Position.X.Scale,f.Position.X.Offset,1,0),"\079\117\116","\083\105\110\101",.5,true)wait(.5)G:Destroy()end)f.BackgroundColor3=g.BackgroundColor3 B.MouseButton1Click:Connect(function()if g.Visible then g.Visible=false f.BackgroundTransparency=g.BackgroundTransparency B.Text="\043"else g.Visible=true f.BackgroundTransparency=1 B.Text="-"end end)u.Move:Connect(function(t,s)if k then I=b+(R.Position.X.Offset+20)m=J+(R.Position.Y.Offset+20)if I<200 then I=200 end if m<200 then m=200 end f.Size=UDim2.new(0,I,0,30)g.Size=UDim2.new(1,0,0,m)if I<220 then if N==""then N=c.Text end c.Text=""else if N~=""then c.Text=N N=""end end end end)R.DragBegin:Connect(function(t)k=true end)R.DragStopped:Connect(function(t,s)k=false b=I J=m R.Position=UDim2.new(1,-20,1,-20)end)G:Ready()while wait(1)do L()end end
--// All global vars will be wiped/replaced except script
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, env)
	if env then
		setfenv(1, env)
	end

	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
