return function(C)local P=service.Players.LocalPlayer local o=P:GetMouse()local T=service.UserInputService local I=C.gIndex local t=C.gTable local G=t.BindEvent local W=t.Object local w=C.Name local b=C.Icon local c=C.Size local m=C.Menu local j=C.Title local Y=C.Ready local y=C.Walls local Z=C.NoHide local U=C.NoClose local s=C.OnReady local L=C.OnClose local R=C.OnResize local E=C.OnRefresh local e=C.OnMinimize local x=C.ContextMenu local r=C.ResetOnSpawn local u=C.CanKeepAlive local g=C.IconClicked local Q=C.SizeLocked or C.SizeLock local B=C.CanvasSize local X=C.Position local l=C.Content or C.Children local A=C.MinSize or{150,50}local J=C.MaxSize or{math.huge;math.huge}local F=o.Icon local N=false local H=false local O=false local h=true local K=service.CheckProperty local f={}local d local q local D local S local n=W.Drag local v=n.Close local M=n.Hide local a=n.Icon local p=n.Title local k=n.Refresh local i=k.Spinner local V=n.Main local z=W.Desc local CG=W.Drag.Main.ScrollingFrame local PG=V.LeftResizeIcon local oG=V.RightResizeIcon local TG=V.RightCorner local IG=V.LeftCorner local tG=V.RightSide local GG=V.LeftSide local WG=V.TopRight local wG=V.TopLeft local bG=V.Bottom local cG=V.Top function Expand(C,P,o)local T=P:FindFirstChild("\076\097\098\101\108")if T then C.MouseLeave:connect(function(o,T)if d==C then P.Visible=false end end)C.MouseMoved:connect(function(I,t)d=C T.Text=o or C.Desc.Value local G=500 local W=(service.TextService:GetTextSize(o or C.Desc.Value,T.TextSize,T.Font,Vector2.new(1000,1000))).X local w=math.floor(W/500)w=w+1 if w<1 then w=1 end if W<500 then G=W end P.Size=UDim2.new(0,G+10,0,w*20+10)P.Position=UDim2.new(0,I+6,0,(t-40)-(w*20+10))P.Visible=true end)end end function getNextPos(C)local P,o for C,T in next,C:GetChildren()do if K(T,"\083\105\122\101")then if not P or T.AbsolutePosition.X+T.AbsoluteSize.X>P.AbsolutePosition.X+P.AbsoluteSize.X then P=T end if not o or T.AbsolutePosition.Y+T.AbsoluteSize.Y>P.AbsolutePosition.Y+P.AbsoluteSize.Y then o=T end end end return(not P or not o)and UDim2.new(0,0,0,0)or UDim2.new(P.Position.X.Scale,P.Position.X.Offset+P.AbsoluteSize.X,o.Position.Y.Scale,o.Position.Y.Offset+o.AbsoluteSize.Y)end function D(C,P)if P then local o=P.RunWhenDone and functionify(P.RunWhenDone,C)for P,T in next,P do if type(T)=="\116\097\098\108\101"then if not T.Parent then T.Parent=C end create(T.Class or T.ClassName or P,T)elseif type(T)=="\102\117\110\099\116\105\111\110"or type(T)=="\115\116\114\105\110\103"and not o then o=functionify(T,C)end end if o then o(C)end end end function S()for C,P in ipairs(P.PlayerGui:GetChildren())do if P:FindFirstChild("\095\095\065\068\079\078\073\083\095\087\073\078\068\079\087")then P.DisplayOrder=100 end end W.DisplayOrder=101 end function q(C)local P=1 local o local T local I=M if M.Visible then P=P+1 end if v.Visible then P=P+1 end if k.Visible then P=P+1 end o=UDim2.new(1,-((30*P+5)+(P-1)),0,0)C.Position=C.Position or o C.Size=C.Size or I.Size C.BackgroundColor3=C.BackgroundColor3 or I.BackgroundColor3 C.BackgroundTransparency=C.BackgroundTransparency or I.BackgroundTransparency C.BorderSizePixel=C.BorderSizePixel or I.BorderSizePixel C.ZIndex=C.ZIndex or I.ZIndex C.TextColor3=C.TextColor3 or I.TextColor3 C.TextScaled=C.TextScaled or I.TextScaled C.TextStrokeColor3=C.TextStrokeColor3 or I.TextStrokeColor3 C.TextSize=C.TextSize or I.TextSize C.TextTransparency=C.TextTransparency or I.TextTransparency C.TextStrokeTransparency=C.TextStrokeTransparency or I.TextStrokeTransparency C.TextScaled=C.TextScaled or I.TextScaled C.TextWrapped=C.TextWrapped or I.TextWrapped C.Font=C.Font or I.Font C.Parent=n return create("\084\101\120\116\066\117\116\116\111\110",C)end function functionify(C,P)if type(C)=="\115\116\114\105\110\103"then if P then local o=GetEnv()o.Object=P return client.Core.LoadCode(C,o)else return client.Core.LoadCode(C)end else return C end end function create(C,P,T)local I=P or{}local t=I.Class or I.ClassName or C local w=T or f[t]and f[t]:Clone()or service.New(t)local b=I.Parent or w.Parent if P then I.Parent=nil if I.Class or I.ClassName then I.Class=nil I.ClassName=nil end if not I.BorderColor3 and K(w,"\066\111\114\100\101\114\067\111\108\111\114\051")then w.BorderColor3=dBorder end if not I.CanvasSize and K(w,"\067\097\110\118\097\115\083\105\122\101")then w.CanvasSize=dCanvasSize end if not I.BorderSizePixel and K(w,"\066\111\114\100\101\114\083\105\122\101\080\105\120\101\108")then w.BorderSizePixel=dPixelSize end if not I.BackgroundColor3 and K(w,"\066\097\099\107\103\114\111\117\110\100\067\111\108\111\114\051")then w.BackgroundColor3=dBackground end if not I.PlaceholderColor3 and K(w,"\080\108\097\099\101\104\111\108\100\101\114\067\111\108\111\114\051")then w.PlaceholderColor3=dPlaceholderColor end if not I.Transparency and(not I.BackgroundTransparency and K(w,"\084\114\097\110\115\112\097\114\101\110\099\121"))then w.BackgroundTransparency=dTransparency elseif I.Transparency then w.BackgroundTransparency=I.Transparency end if not I.TextColor3 and(not I.TextColor and K(w,"\084\101\120\116\067\111\108\111\114\051"))then w.TextColor3=dTextColor elseif I.TextColor then w.TextColor3=I.TextColor end if not I.Font and K(w,"\070\111\110\116")then I.Font=dFont end if not I.TextSize and K(w,"\084\101\120\116\083\105\122\101")then I.TextSize=dTextSize end if not I.BottomImage and(not I.MidImage and(not I.TopImage and t=="\083\099\114\111\108\108\105\110\103\070\114\097\109\101"))then w.BottomImage=dScrollImage w.MidImage=dScrollImage w.TopImage=dScrollImage end if not I.Size and K(w,"\083\105\122\101")then w.Size=dSize end if not I.Position and K(w,"\080\111\115\105\116\105\111\110")then w.Position=dPosition end if not I.ZIndex and K(w,"\090\073\110\100\101\120")then w.ZIndex=dZIndex if b and K(b,"\090\073\110\100\101\120")then w.ZIndex=b.ZIndex end end if I.TextChanged and t=="\084\101\120\116\066\111\120"then local C=functionify(I.TextChanged,w)w.FocusLost:connect(function(P)C(w.Text,P,w)end)end if(I.OnClicked or I.OnClick)and t=="\084\101\120\116\066\117\116\116\111\110"then local C=false local P=I.Debounce local o=functionify(I.OnClicked or I.OnClick,w)w.MouseButton1Down:connect(function()if not C then if P then C=true end o(w)C=false end end)end if I.Events then for C,P in pairs(I.Events)do local o=functionify(P,w)G(w[C],function(...)o(...)end)end end if I.Visible==nil then I.Visible=true end if I.LabelProps then I.LabelProperties=I.LabelProps end end if t=="\069\110\116\114\121"then local C=w.Text local P=w.Dots local o=w.Desc C.ZIndex=I.ZIndex or w.ZIndex P.ZIndex=I.ZIndex or w.ZIndex if I.Text then w.Text.Text=I.Text w.Text.Visible=true I.Text=nil end if I.Desc or I.ToolTip then w.Desc.Value=I.Desc or I.ToolTip I.Desc=nil end Expand(w,z)else if I.ToolTip then Expand(w,z,I.ToolTip)end end if t=="\066\117\116\116\111\110\069\110\116\114\121"then local C=w.Button local P=false local o=functionify(I.OnClicked,C)w:SetSpecial("\068\111\067\108\105\099\107",function()if not P then P=true if o then o(C)end P=false end end)w.Text=I.Text or w.Text C.ZIndex=I.ZIndex or w.ZIndex C.MouseButton1Down:connect(w.DoClick)end if t=="\066\111\111\108\101\097\110"then local C=I.Enabled local P=false local o=functionify(I.OnToggle,w)local function T(T)if not P then P=true if T~=nil and T or T==nil and C then C=false w.Text="\068\105\115\097\098\108\101\100"elseif T~=nil and T==false or T==nil and not C then C=true w.Text="\069\110\097\098\108\101\100"end if o then o(C,w)end P=false end end w.Text=C and"\069\110\097\098\108\101\100"or"\068\105\115\097\098\108\101\100"w.MouseButton1Down:connect(function()if o then T()end end)w:SetSpecial("\084\111\103\103\108\101",function(C,P)T(P)end)end if t=="\083\116\114\105\110\103\069\110\116\114\121"then local C=w.Box local P w.Text=I.Text or w.Text C.ZIndex=I.ZIndex or w.ZIndex if I.BoxText then C.Text=I.BoxText end if I.BoxProperties then for P,o in next,I.BoxProperties do if K(C,P)then C[P]=o end end end if I.TextChanged then local o=functionify(I.TextChanged,C)C.Changed:connect(function(T)if T=="\084\101\120\116"and not P then o(C.Text)end end)C.FocusLost:connect(function(T)local I=o(C.Text,true,T)if I then P=true C.Text=I P=false end end)end w:SetSpecial("\083\101\116\086\097\108\117\101",function(P,o)C.Text=o end)end if t=="\083\108\105\100\101\114"then local C=false local P=w.Percentage local T=w.Slider local t=w.SliderBar local G=w.Drag local W=false local b=0 local c=functionify(I.OnSlide,w)t.ZIndex=I.ZIndex or w.ZIndex T.ZIndex=t.ZIndex+1 G.ZIndex=T.ZIndex+1 G.Active=true if I.Value then T.Position=UDim2.new(.5,-10,.5,-10)G.Position=T.Position end t.InputBegan:connect(function(C)if not W and C.UserInputType==Enum.UserInputType.MouseButton1 then b=(o.X-w.AbsolutePosition.X)/w.AbsoluteSize.X if b<0 then b=0 elseif b>1 then b=1 end T.Position=UDim2.new(b,-10,.5,-10)G.Position=T.Position P.Value=b if c then c(b)end end end)G.DragBegin:connect(function()W=true end)G.DragStopped:connect(function()W=false G.Position=T.Position end)G.Changed:connect(function()if W then b=(o.X-w.AbsolutePosition.X)/w.AbsoluteSize.X if b<0 then b=0 elseif b>1 then b=1 end T.Position=UDim2.new(b,-10,.5,-10)P.Value=b if c then c(b)end end end)w:SetSpecial("\083\101\116\086\097\108\117\101",function(C,o)if o and tonumber(o)then b=tonumber(o)P.Value=b T.Position=UDim2.new(b,-10,.5,-10)G.Position=T.Position end end)end if t=="\068\114\111\112\100\111\119\110"then local C=w.Menu local P=w.Down local o=w.dSelected local T=I.Options local t=I.Selected or I.Selection local G=functionify(I.OnSelection or I.OnSelect or function() end)local b=I.TextProperties local c=create("\083\099\114\111\108\108\105\110\103\070\114\097\109\101",{Parent=C;Size=UDim2.new(1,0,1,0),Position=UDim2.new(0,0,0,0);BackgroundTransparency=1;ZIndex=100})C.ZIndex=c.ZIndex C.Parent=W C.Visible=false C.Size=UDim2.new(0,w.AbsoluteSize.X,0,100)C.BackgroundColor3=I.BackgroundColor3 or w.BackgroundColor3 if I.TextAlignment then o.TextXAlignment=I.TextAlignment o.Position=UDim2.new(0,30,0,0)end if I.NoArrow then P.Visible=false end w:SetSpecial("\077\101\110\117\067\111\110\116\097\105\110\101\114",C)w.Changed:Connect(function(t)if t=="\065\098\115\111\108\117\116\101\080\111\115\105\116\105\111\110"and C.Visible then C.Position=UDim2.new(0,w.AbsolutePosition.X,0,w.AbsolutePosition.Y+w.AbsoluteSize.Y)elseif t=="\065\098\115\111\108\117\116\101\083\105\122\101"or t=="\080\097\114\101\110\116"then P.Size=UDim2.new(0,w.AbsoluteSize.Y,1,0)if I.TextAlignment=="\082\105\103\104\116"then P.Position=UDim2.new(0,0,.5,-(P.AbsoluteSize.X/2))o.Position=UDim2.new(0,w.AbsoluteSize.Y,0,0)else P.Position=UDim2.new(1,-P.AbsoluteSize.X,.5,-(P.AbsoluteSize.X/2))end o.Size=UDim2.new(1,-P.AbsoluteSize.X,1,0)if T and#T<=6 then C.Size=UDim2.new(0,w.AbsoluteSize.X,0,30*#T)else C.Size=UDim2.new(0,w.AbsoluteSize.X,0,180)c:ResizeCanvas(false,true)end end end)o.ZIndex=w.ZIndex P.ZIndex=w.ZIndex if b then for C,P in next,b do o[C]=P end end if T then for P,T in next,T do local I=c:Add("\084\101\120\116\066\117\116\116\111\110",{Text="  "..tostring(T),Size=UDim2.new(1,-10,0,30);Position=UDim2.new(0,5,0,30*(P-1));ZIndex=C.ZIndex,BackgroundTransparency=1,OnClick=function()o.Text=T G(T,w)C.Visible=false end})if b then for C,P in next,b do I[C]=P end end end if t then o.Text=t else o.Text="\078\111 \083\101\108\101\099\116\105\111\110"end o.MouseButton1Down:Connect(function()C.Position=UDim2.new(0,w.AbsolutePosition.X,0,w.AbsolutePosition.Y+w.AbsoluteSize.Y)C.Visible=not C.Visible end)end end if t=="\084\097\098\070\114\097\109\101"then local C=create("\083\099\114\111\108\108\105\110\103\070\114\097\109\101",nil,w.Buttons)local P=w.Frames local o=0 local T=I.ButtonSize or 60 w.BackgroundTransparency=I.BackgroundTransparency or 1 C.ZIndex=I.ZIndex or w.ZIndex P.ZIndex=C.ZIndex w:SetSpecial("\071\101\116\084\097\098",function(C,o)return P:FindFirstChild(o)end)w:SetSpecial("\078\101\119\084\097\098",function(T,I,t)local G=t or{}local W=getNextPos(C)local w=service.TextService:GetTextSize(G.Text or I,dTextSize,dFont,C.AbsoluteSize)local b=G.TextTransparency local c=false local m=false local j=create("\083\099\114\111\108\108\105\110\103\070\114\097\109\101",{Name=I;Size=UDim2.new(1,0,1,0);Position=UDim2.new(0,0,0,0),BorderSizePixel=0;BackgroundTransparency=G.FrameTransparency or G.Transparency,BackgroundColor3=G.Color or dBackground:lerp(Color3.new(1,1,1),.2),ZIndex=C.ZIndex;Visible=false})local Y=create("\084\101\120\116\066\117\116\116\111\110",{Name=I;Text=G.Text or I;Size=UDim2.new(0,w.X+20,1,0),ZIndex=C.ZIndex,Position=UDim2.new(0,W.X.Offset>0 and W.X.Offset+5 or 0,0,0);TextColor3=G.TextColor,BackgroundTransparency=.7,TextTransparency=G.TextTransparency,BackgroundColor3=G.Color or dBackground:lerp(Color3.new(1,1,1),.2),BorderSizePixel=0})j:SetSpecial("\070\111\099\117\115\084\097\098",function()for C,P in next,C:GetChildren()do if isGui(P)then P.BackgroundTransparency=.7 P.TextTransparency=.7 end end for C,P in next,P:GetChildren()do if isGui(P)then P.Visible=false end end Y.BackgroundTransparency=G.Transparency or 0 Y.TextTransparency=G.TextTransparency or 0 j.Visible=true if G.OnFocus then G.OnFocus(true)end end)if o==0 then j.Visible=true Y.BackgroundTransparency=G.Transparency or 0 end Y.MouseButton1Down:connect(function()if not m then j:FocusTab()end end)Y.Parent=C j.Parent=P C:ResizeCanvas(true,false)j:SetSpecial("\068\105\115\097\098\108\101",function()m=true Y.BackgroundTransparency=.9 Y.TextTransparency=.9 end)j:SetSpecial("\069\110\097\098\108\101",function()m=false Y.BackgroundTransparency=.7 Y.TextTransparency=G.TextTransparency or 0 end)o=o+1 return j,Y end)end if t=="\083\099\114\111\108\108\105\110\103\070\114\097\109\101"then local C=false if not I.ScrollBarThickness then I.ScrollBarThickness=dScrollBar end w:SetSpecial("\071\101\110\101\114\097\116\101\076\105\115\116",function(P,o,T,t)local G=o or P local W={}local b=T or{}C=W w:ClearAllChildren()local c=0 for P,o in next,G do local t=o local G local m local j if type(o)=="\116\097\098\108\101"then t=o.Text G=o.Desc m=o.Color if o.RichTextAllowed or b.RichTextAllowed then j=true end end local Y=create("\084\101\120\116\076\097\098\101\108",{Text=" "..tostring(t),ToolTip=G,Size=UDim2.new(1,-5,0,b.ySize or 20),Visible=true,BackgroundTransparency=1,Font="\065\114\105\097\108";TextSize=14,TextStrokeTransparency=.8,TextXAlignment="\076\101\102\116";Position=UDim2.new(0,0,0,c*(b.ySize or 20));RichText=j or false})if m then Y.TextColor3=m end if T then for C,P in next,b do if K(Y,C)then Y[C]=P end end end if C==W then Y.Parent=w else Y:Destroy()break end c=c+1 if I.Delay then if type(I.Delay)=="\110\117\109\098\101\114"then wait(I.Delay)elseif P%100==0 then wait(.1)end end end w:ResizeCanvas(false,true,false,t,5,5,50)C=nil end)w:SetSpecial("\082\101\115\105\122\101\067\097\110\118\097\115",function(C,P,o,T,t,G,W,b)local c,m=I.xPadding or 5,I.yPadding or 5 local j,Y=0,0 if not P and not o then P=false o=true end for C,T in next,w:GetChildren()do if T:IsA("\071\117\105\079\098\106\101\099\116")then if o then T.Size=UDim2.new(T.Size.X.Scale,T.Size.X.Offset,0,T.AbsoluteSize.Y)T.Position=UDim2.new(T.Position.X.Scale,T.Position.X.Offset,0,T.AbsolutePosition.Y-w.AbsolutePosition.Y)end if P then T.Size=UDim2.new(0,T.AbsoluteSize.X,T.Size.Y.Scale,T.Size.Y.Offset)T.Position=UDim2.new(0,T.AbsolutePosition.X-w.AbsolutePosition.X,T.Position.Y.Scale,T.Position.Y.Offset)end local I=T.Position.Y.Offset+T.Size.Y.Offset local t=T.Position.X.Offset+T.Size.X.Offset j=math.max(j,I)Y=math.max(Y,t)if b then if C%b==0 then wait(.016666666666667)end end end end if o then w.CanvasSize=UDim2.new(w.CanvasSize.X.Scale,w.CanvasSize.X.Offset,0,j+m)end if P then w.CanvasSize=UDim2.new(0,Y+c,w.CanvasSize.Y.Scale,w.CanvasSize.Y.Offset)end if T then w.CanvasPosition=Vector2.new((Y+c)-w.AbsoluteSize.X,w.CanvasPosition.Y)end if t then w.CanvasPosition=Vector2.new(w.CanvasPosition.X,(j+m)-w.AbsoluteSize.Y)end end)if I.List then w:GenerateList(I.List)I.List=nil end end D(w,I.Content or I.Children)I.Children=nil I.Content=nil for C,P in next,I do if K(w,C)then w[C]=P end end w.Parent=b return apiIfy(w,I,t),I end function apiIfy(C,P,o)local T=service.Wrap(C)C:SetSpecial("\079\098\106\101\099\116",C)C:SetSpecial("\083\101\116\080\111\115\105\116\105\111\110",function(P,o)C.Position=o end)C:SetSpecial("\083\101\116\083\105\122\101",function(P,o)C.Size=o end)C:SetSpecial("\065\100\100",function(P,o,T)if not T then T=o o=P end local I=create(o,T)I.Parent=C return apiIfy(I,T,o)end)C:SetSpecial("\067\111\112\121",function(o,T,I)local t={}local G for C,P in next,P do t[C]=P end for C,P in next,I do t[C]=P end G=create(T or P.Class or C.ClassName,t)G.Parent=I.Parent or C.Parent return apiIfy(G,P,T)end)return T end function doClose()if not N then N=true t:Destroy()end end function isVisible()return V.Visible end function doHide(C)local P=M.LineHeight if C or C==nil and V.Visible then dragSize=n.Size V.Visible=false n.BackgroundTransparency=V.BackgroundTransparency n.BackgroundColor3=V.BackgroundColor3 n.Size=UDim2.new(0,200,n.Size.Y.Scale,n.Size.Y.Offset)M.Text="\043"M.LineHeight=P t.Minimized=true elseif C==false or C==nil and not V.Visible then V.Visible=true n.BackgroundTransparency=1 n.Size=dragSize or n.Size M.Text="-"M.LineHeight=P t.Minimized=false end if e then e(V.Visible)end if y then wallPosition()end end function isInFrame(C,P,o)if C>o.AbsolutePosition.X and(C<o.AbsolutePosition.X+o.AbsoluteSize.X and(P>o.AbsolutePosition.Y and P<o.AbsolutePosition.Y+o.AbsoluteSize.Y))then return true else return false end end function wallPosition()if t.Active then local C,P=n.AbsolutePosition.X,n.AbsolutePosition.Y local o,T,I=n.AbsoluteSize.X,W.AbsoluteSize.X,W.AbsoluteSize.Y local t=V.Visible and V.AbsoluteSize.Y or n.AbsoluteSize.Y if C<0 then n.Position=UDim2.new(0,0,n.Position.Y.Scale,n.Position.Y.Offset)end if P<0 then n.Position=UDim2.new(n.Position.X.Scale,n.Position.X.Offset,0,0)end if C+o>T then n.Position=UDim2.new(0,W.AbsoluteSize.X-n.AbsoluteSize.X,n.Position.Y.Scale,n.Position.Y.Offset)end if P+t>I then n.Position=UDim2.new(n.Position.X.Scale,n.Position.X.Offset,0,W.AbsoluteSize.Y-t)end end end function setSize(C)if C and type(C)=="\116\097\098\108\101"then if C[1]<50 then C[1]=50 end if C[2]<50 then C[2]=50 end n.Size=UDim2.new(0,C[1],0,25)V.Size=UDim2.new(1,0,0,C[2])end end function setPosition(C)if C and typeof(C)=="\085\068\105\109\050"then n.Position=C elseif C and type(C)=="\116\097\098\108\101"then n.Position=UDim2.new(0,C[1],0,C[2])elseif c and not C then n.Position=UDim2.new(.5,-n.AbsoluteSize.X/2,.5,-V.AbsoluteSize.Y/2)end end if w then t.Name=w if C.AllowMultiple~=nil and C.AllowMultiple==false then local C,P=client.UI.Get(w,W,true)if C then doClose()return nil end end end if c then setSize(c)end if X then setPosition(X)end if j then p.Text=j end if u or not r then t.CanKeepAlive=true W.ResetOnSpawn=false elseif r then t.CanKeepAlive=false W.ResetOnSpawn=true end if b then a.Visible=true a.Image=b end if B then CG.CanvasSize=B end if U then v.Visible=false k.Position=M.Position M.Position=v.Position end if Z then M.Visible=false k.Position=M.Position end if y then n.DragStopped:connect(function()wallPosition()end)end if E then local C=false function DoRefresh()if not O then local C=false O=true spawn(function()while t.Active and not C do for C=0,180,10 do i.Rotation=-C wait(.016666666666667)end end end)E()wait(1)C=true O=false end end k.MouseButton1Down:connect(function()if not C then C=true DoRefresh()C=false end end)p.Size=UDim2.new(1,-130,p.Size.Y.Scale,p.Size.Y.Offset)else k.Visible=false end if g then a.MouseButton1Down(function()g(C,W,a)end)end if m then C.Menu.Text=""C.Menu.Parent=V C.Menu.Size=UDim2.new(1,-10,0,25)C.Menu.Position=UDim2.new(0,5,0,25)CG.Size=UDim2.new(1,-10,1,-55)CG.Position=UDim2.new(0,5,0,50)C.Menu.BackgroundColor3=Color3.fromRGB(216,216,216)C.Menu.BorderSizePixel=0 create("\084\101\120\116\076\097\098\101\108",C.Menu)end if not Q then local C=n.AbsolutePosition.X local P=n.AbsolutePosition.Y local I=n.AbsoluteSize.X local W=n.AbsoluteSize.Y local w=client.Variables local b local c local m local function j(C)C.MouseEnter:connect(function()m=C end)C.MouseLeave:connect(function()if m==C then m=nil end end)end function checkMouse(C,P)if t.Active and V.Visible then if isInFrame(C,P,n)or isInFrame(C,P,CG)then c=nil b=nil elseif isInFrame(C,P,WG)then c="\084\111\112\082\105\103\104\116"b=MouseIcons.TopRight elseif isInFrame(C,P,wG)then c="\084\111\112\076\101\102\116"b=MouseIcons.TopLeft elseif isInFrame(C,P,TG)then c="\082\105\103\104\116\067\111\114\110\101\114"b=MouseIcons.RightCorner elseif isInFrame(C,P,IG)then c="\076\101\102\116\067\111\114\110\101\114"b=MouseIcons.LeftCorner elseif isInFrame(C,P,tG)then c="\082\105\103\104\116\083\105\100\101"b=MouseIcons.Horizontal elseif isInFrame(C,P,GG)then c="\076\101\102\116\083\105\100\101"b=MouseIcons.Horizontal elseif isInFrame(C,P,bG)then c="\066\111\116\116\111\109"b=MouseIcons.Vertical elseif isInFrame(C,P,cG)then c="\084\111\112"b=MouseIcons.Vertical else c=nil b=nil end else c=nil end if not client.Variables.MouseLockedBy or client.Variables.MouseLockedBy==t then if c and b then o.Icon=b client.Variables.MouseLockedBy=t elseif client.Variables.MouseLockedBy==t then o.Icon=F client.Variables.MouseLockedBy=nil end end end local function Y(o,T)checkMouse(o,T)if t.Active and(c and(not H and(not isInFrame(o,T,CG)and not isInFrame(o,T,n))))then H=c C=n.AbsolutePosition.X P=n.AbsolutePosition.Y I=n.AbsoluteSize.X W=V.AbsoluteSize.Y end end local function y()if t.Active then if H and R then R(UDim2.new(n.Size.X.Scale,n.Size.X.Offset,V.Size.Y.Scale,V.Size.Y.Offset))end H=nil o.Icon=F end end local function Z(T,G)if t.Active then if o.Icon~=MouseIcons.TopRight and(o.Icon~=MouseIcons.TopLeft and(o.Icon~=MouseIcons.RightCorner and(o.Icon~=MouseIcons.LeftCorner and(o.Icon~=MouseIcons.Horizontal and o.Icon~=MouseIcons.Vertical))))then F=o.Icon end if H then local o=false local t=false local w=n.Position local b,c=T,G local m,j=I,W if H=="\084\111\112\082\105\103\104\116"then m=(b-C)+3 j=((P-c)+W)-1 t=true elseif H=="\084\111\112\076\101\102\116"then m=((C-b)+I)-1 j=((P-c)+W)-1 t=true o=true elseif H=="\082\105\103\104\116\067\111\114\110\101\114"then m=(b-C)+3 j=(c-P)+3 elseif H=="\076\101\102\116\067\111\114\110\101\114"then m=((C-b)+I)+3 j=(c-P)+3 o=true elseif H=="\076\101\102\116\083\105\100\101"then m=((C-b)+I)+3 j=W o=true elseif H=="\082\105\103\104\116\083\105\100\101"then m=(b-C)+3 j=W elseif H=="\066\111\116\116\111\109"then m=I j=(c-P)+3 elseif H=="\084\111\112"then m=I j=((P-c)+W)-1 t=true end if m<A[1]then m=A[1]end if j<A[2]then j=A[2]end if m>J[1]then m=J[1]end if j>J[2]then j=J[2]end if o then w=UDim2.new(0,(C+I)-m,w.Y.Scale,w.Y.Offset)end if t then w=UDim2.new(w.X.Scale,w.X.Offset,0,(P+W)-j)end n.Position=w n.Size=UDim2.new(0,m,n.Size.Y.Scale,n.Size.Y.Offset)V.Size=UDim2.new(V.Size.X.Scale,V.Size.X.Offset,0,j)if not p.TextFits then p.Visible=false else p.Visible=true end else checkMouse(T,G)end end end G(T.InputBegan,function(C,P)if not P and(C.UserInputType==Enum.UserInputType.MouseButton1 or C.UserInputType==Enum.UserInputType.Touch)then Y(o.X,o.Y)end end)G(T.InputChanged,function(C,P)if C.UserInputType==Enum.UserInputType.MouseMovement or Enum.UserInputType.Touch then Z(C.Position.X,C.Position.Y)end end)G(T.InputEnded,function(C,P)if C.UserInputType==Enum.UserInputType.MouseButton1 or Enum.UserInputType.Touch then y()end end)else PG.Visible=false oG.Visible=false end v.MouseButton1Down:connect(doClose)M.MouseButton1Down:connect(function()doHide()end)t.CustomDestroy=function()(service.UnWrap(W)):Destroy()if client.Variables.MouseLockedBy==t then o.Icon=F client.Variables.MouseLockedBy=nil end if not N then N=true if L then L()end end end for C,P in next,W:GetChildren()do if P.Name~="\068\101\115\099"and P.Name~="\068\114\097\103"then f[P.Name]=P P.Parent=nil end end do local C=Instance.new("\066\111\111\108\086\097\108\117\101",W)local P=false local o local I C.Name="\095\095\065\068\079\078\073\083\095\087\073\078\068\079\087"G(V.InputBegan,function(C)if t.Active and(C.UserInputType==Enum.UserInputType.MouseButton1 or C.UserInputType==Enum.UserInputType.Touch)then S()end end)G(n.InputBegan,function(C)if t.Active then I=true if C.UserInputType==Enum.UserInputType.MouseButton1 or C.UserInputType==Enum.UserInputType.Touch then S()end end end)G(n.InputChanged,function(C)if t.Active then I=true end end)G(n.InputEnded,function(C)I=false end)G(T.InputBegan,function(C)if I and(W.DisplayOrder==101 and(not P and(C.UserInputType==Enum.UserInputType.MouseButton1 or C.UserInputType==Enum.UserInputType.Touch)))then P=true S()o=Vector2.new(n.AbsolutePosition.X-C.Position.X,n.AbsolutePosition.Y-C.Position.Y)end end)G(T.InputChanged,function(C)if P and(C.UserInputType==Enum.UserInputType.MouseMovement or C.UserInputType==Enum.UserInputType.Touch)then n.Position=UDim2.new(0,o.X+C.Position.X,0,o.Y+C.Position.Y)end end)G(T.InputEnded,function(C)if C.UserInputType==Enum.UserInputType.MouseButton1 or C.UserInputType==Enum.UserInputType.Touch then P=false end end)end local mG=apiIfy(CG,C)local jG=mG:GetMetatable()local YG=jG.__newindex local yG=jG.__index create("\083\099\114\111\108\108\105\110\103\070\114\097\109\101",nil,CG)D(mG,l)mG:SetSpecial("\103\084\097\098\108\101",t)mG:SetSpecial("\087\105\110\100\111\119",W)mG:SetSpecial("\077\097\105\110",V)mG:SetSpecial("\084\105\116\108\101",p)mG:SetSpecial("\068\114\097\103\103\101\114",n)mG:SetSpecial("\068\101\115\116\114\111\121",doClose)mG:SetSpecial("\067\108\111\115\101",doClose)mG:SetSpecial("\079\098\106\101\099\116",CG)mG:SetSpecial("\082\101\102\114\101\115\104",DoRefresh)mG:SetSpecial("\065\100\100\084\105\116\108\101\066\117\116\116\111\110",function(C,P)if type(C)=="\116\097\098\108\101"and not P then P=C end return q(P)end)mG:SetSpecial("\082\101\097\100\121",function()if s then s()end t.Ready()S()end)mG:SetSpecial("\066\105\110\100\069\118\101\110\116",function(C,...)G(...)end)mG:SetSpecial("\072\105\100\101",function(C,P)doHide(P)end)mG:SetSpecial("\083\101\116\084\105\116\108\101",function(C,P)p.Text=P end)mG:SetSpecial("\083\101\116\080\111\115\105\116\105\111\110",function(C,P)setPosition(P)end)mG:SetSpecial("\083\101\116\083\105\122\101",function(C,P)setSize(P)end)mG:SetSpecial("\071\101\116\080\111\115\105\116\105\111\110",function()return n.AbsolutePosition end)mG:SetSpecial("\071\101\116\083\105\122\101",function()return V.AbsoluteSize end)mG:SetSpecial("\073\115\086\105\115\105\098\108\101",isVisible)mG:SetSpecial("\073\115\067\108\111\115\101\100",N)jG.__index=function(C,P)if P=="\073\115\086\105\115\105\098\108\101"then return isVisible()elseif P=="\067\108\111\115\101\100"then return N else return yG(C,P)end end setSize(c)setPosition(X)if Y then t:Ready()S()end return mG,W end

return function(data)
	--local client = service.GarbleTable(client)
	local Player = service.Players.LocalPlayer
	local Mouse = Player:GetMouse()
	local InputService = service.UserInputService
	local gIndex = data.gIndex
	local gTable = data.gTable
	
	local Event = gTable.BindEvent
	local GUI = gTable.Object
	local Name = data.Name
	local Icon = data.Icon
	local Size = data.Size
	local Menu = data.Menu
	local Title = data.Title
	local Ready = data.Ready
	local Walls = data.Walls
	local noHide = data.NoHide
	local noClose = data.NoClose
	local onReady = data.OnReady
	local onClose = data.OnClose
	local onResize = data.OnResize
	local onRefresh = data.OnRefresh
	local onMinimize = data.OnMinimize
	local ContextMenu = data.ContextMenu
	local ResetOnSpawn = data.ResetOnSpawn
	local CanKeepAlive = data.CanKeepAlive
	local iconClicked = data.IconClicked
	local SizeLocked = data.SizeLocked or data.SizeLock
	local CanvasSize = data.CanvasSize
	local Position = data.Position
	local Content = data.Content or data.Children
	local MinSize = data.MinSize or {150, 50}
	local MaxSize = data.MaxSize or {math.huge, math.huge}
	local curIcon = Mouse.Icon
	local isClosed = false
	local Resizing = false
	local Refreshing = false
	local DragEnabled = true
	local checkProperty = service.CheckProperty
	local specialInsts = {}
	local inExpandable
	local addTitleButton
	local LoadChildren
	local BringToFront
	
	local Drag = GUI.Drag
	local Close = Drag.Close
	local Hide = Drag.Hide
	local Iconf = Drag.Icon
	local Titlef = Drag.Title
	local Refresh = Drag.Refresh
	local rSpinner = Refresh.Spinner
	local Main = Drag.Main
	local Tooltip = GUI.Desc
	local ScrollFrame = GUI.Drag.Main.ScrollingFrame
	local LeftSizeIcon = Main.LeftResizeIcon
	local RightSizeIcon = Main.RightResizeIcon
	local RightCorner = Main.RightCorner
	local LeftCorner = Main.LeftCorner
	local RightSide = Main.RightSide
	local LeftSide = Main.LeftSide
	local TopRight = Main.TopRight
	local TopLeft = Main.TopLeft
	local Bottom = Main.Bottom
	local Top = Main.Top
	
	function Expand(ent, point, text)
		local label = point:FindFirstChild("Label")
		
		if label then
			ent.MouseLeave:connect(function(x,y)
				if inExpandable == ent then
					point.Visible = false
				end
			end)
			
			ent.MouseMoved:connect(function(x,y)
				inExpandable = ent
				label.Text = text or ent.Desc.Value
				--point.Size = UDim2.new(0, 10000, 0, 10000)
				local newx = 500
				local bounds = service.TextService:GetTextSize(text or ent.Desc.Value, label.TextSize, label.Font, Vector2.new(1000,1000)).X-- point.Label.TextBounds.X
				local rows = math.floor(bounds/500)
				rows = rows+1
				if rows<1 then rows = 1 end
				if bounds<500 then newx = bounds end
				point.Size = UDim2.new(0, newx+10, 0, (rows*20)+10)
				point.Position = UDim2.new(0, x+6, 0, y-40-((rows*20)+10))
				point.Visible = true
			end)
		end
	end
	
	function getNextPos(frame)
		local farXChild, farYChild
		for i,v in next,frame:GetChildren() do
			if checkProperty(v, "Size") then
				if not farXChild or (v.AbsolutePosition.X + v.AbsoluteSize.X) > (farXChild.AbsolutePosition.X + farXChild.AbsoluteSize.X) then
					farXChild = v
				end
				
				if not farYChild or (v.AbsolutePosition.Y + v.AbsoluteSize.Y) > (farXChild.AbsolutePosition.Y + farXChild.AbsoluteSize.Y) then
					farYChild = v
				end
			end
		end
		
		return ((not farXChild or not farYChild) and UDim2.new(0,0,0,0)) or UDim2.new(farXChild.Position.X.Scale, farXChild.Position.X.Offset + farXChild.AbsoluteSize.X, farYChild.Position.Y.Scale, farYChild.Position.Y.Offset + farYChild.AbsoluteSize.Y)
	end
	
	function LoadChildren(Obj, Children)
		if Children then
			local runWhenDone = Children.RunWhenDone and functionify(Children.RunWhenDone, Obj)
			for class,data in next,Children do
				if type(data) == "table" then
					if not data.Parent then data.Parent = Obj end
					create(data.Class or data.ClassName or class, data)
				elseif type(data) == "function" or type(data) == "string" and not runWhenDone then
					runWhenDone = functionify(data, Obj)
				end
			end
			
			if runWhenDone then
				runWhenDone(Obj)
			end
		end
	end
	
	function BringToFront()
		for i,v in ipairs(Player.PlayerGui:GetChildren()) do
			if v:FindFirstChild("__ADONIS_WINDOW") then
				v.DisplayOrder = 100
			end
		end
		
		GUI.DisplayOrder = 101
	end
	
	function addTitleButton(data)
		local startPos = 1
		local realPos
		local new 
		local original = Hide
		
		if Hide.Visible then
			startPos = startPos+1
		end
		
		if Close.Visible then
			startPos = startPos+1
		end
		
		if Refresh.Visible then
			startPos = startPos+1
		end
		
		realPos = UDim2.new(1, -(((30*startPos)+5)+(startPos-1)), 0, 0)
		data.Position = data.Position or realPos
		data.Size = data.Size or original.Size
		data.BackgroundColor3 = data.BackgroundColor3 or original.BackgroundColor3
		data.BackgroundTransparency = data.BackgroundTransparency or original.BackgroundTransparency
		data.BorderSizePixel = data.BorderSizePixel or original.BorderSizePixel
		data.ZIndex = data.ZIndex or original.ZIndex
		data.TextColor3 = data.TextColor3 or original.TextColor3
		data.TextScaled = data.TextScaled or original.TextScaled
		data.TextStrokeColor3 = data.TextStrokeColor3 or original.TextStrokeColor3
		data.TextSize = data.TextSize or original.TextSize
		data.TextTransparency = data.TextTransparency or original.TextTransparency
		data.TextStrokeTransparency = data.TextStrokeTransparency or original.TextStrokeTransparency
		data.TextScaled = data.TextScaled or original.TextScaled
		data.TextWrapped = data.TextWrapped or original.TextWrapped
		--data.TextXAlignment = data.TextXAlignment or original.TextXAlignment
		--data.TextYAlignment = data.TextYAlignment or original.TextYAlignment
		data.Font = data.Font or original.Font
		data.Parent = Drag
		
		return create("TextButton", data)
	end
	
	function functionify(func, object)
		if type(func) == "string" then
			if object then
				local env = GetEnv()
				env.Object = object
				return client.Core.LoadCode(func, env)
			else
				return client.Core.LoadCode(func)
			end
		else
			return func
		end
	end
	
	function create(class, dataFound, existing)
		local data = dataFound or {}
		local class = data.Class or data.ClassName or class
		local new = existing or (specialInsts[class] and specialInsts[class]:Clone()) or service.New(class)
		local parent = data.Parent or new.Parent
		
		if dataFound then
			data.Parent = nil
			
			if data.Class or data.ClassName then
				data.Class = nil
				data.ClassName = nil
			end
			
			if not data.BorderColor3 and checkProperty(new,"BorderColor3") then
				new.BorderColor3 = dBorder
			end
			
			if not data.CanvasSize and checkProperty(new,"CanvasSize") then
				new.CanvasSize = dCanvasSize
			end
			
			if not data.BorderSizePixel and checkProperty(new,"BorderSizePixel") then
				new.BorderSizePixel = dPixelSize
			end
			
			if not data.BackgroundColor3 and checkProperty(new,"BackgroundColor3") then
				new.BackgroundColor3 = dBackground
			end
			
			if not data.PlaceholderColor3 and checkProperty(new,"PlaceholderColor3") then
				new.PlaceholderColor3 = dPlaceholderColor
			end
			
			if not data.Transparency and not data.BackgroundTransparency and checkProperty(new,"Transparency") then
				new.BackgroundTransparency = dTransparency
			elseif data.Transparency then
				new.BackgroundTransparency = data.Transparency
			end
			
			if not data.TextColor3 and not data.TextColor and checkProperty(new,"TextColor3") then
				new.TextColor3 = dTextColor
			elseif data.TextColor then
				new.TextColor3 = data.TextColor
			end
			
			if not data.Font and checkProperty(new, "Font") then
				data.Font = dFont
			end
			
			if not data.TextSize and checkProperty(new, "TextSize") then
				data.TextSize = dTextSize
			end
			
			if not data.BottomImage and not data.MidImage and not data.TopImage and class == "ScrollingFrame" then
				new.BottomImage = dScrollImage 
				new.MidImage = dScrollImage
				new.TopImage = dScrollImage
			end
			
			if not data.Size and checkProperty(new,"Size") then
				new.Size = dSize
			end
			
			if not data.Position and checkProperty(new,"Position") then
				new.Position = dPosition
			end
			
			if not data.ZIndex and checkProperty(new,"ZIndex") then
				new.ZIndex = dZIndex
				if parent and checkProperty(parent, "ZIndex") then
					new.ZIndex = parent.ZIndex
				end
			end
			
			if data.TextChanged and class == "TextBox" then
				local textChanged = functionify(data.TextChanged, new)
				new.FocusLost:connect(function(enterPressed)
					textChanged(new.Text, enterPressed, new)
				end)
			end
			
			if (data.OnClicked or data.OnClick) and class == "TextButton" then
				local debounce = false;
				local doDebounce = data.Debounce;
				local onClick = functionify((data.OnClicked or data.OnClick), new)
				new.MouseButton1Down:connect(function()
					if not debounce then 
						if doDebounce then
							debounce = true
						end
						
						onClick(new);
						
						debounce = false;
					end
				end)
			end
			
			if data.Events then
				for event,func in pairs(data.Events) do
					local realFunc = functionify(func, new)
					Event(new[event], function(...)
						realFunc(...)
					end)
				end
			end
			
			if data.Visible == nil then
				data.Visible = true
			end
			
			if data.LabelProps then
				data.LabelProperties = data.LabelProps
			end
		end
		
		if class == "Entry" then
			local label = new.Text
			local dots = new.Dots
			local desc = new.Desc
			
			label.ZIndex = data.ZIndex or new.ZIndex
			dots.ZIndex = data.ZIndex or new.ZIndex
			
			if data.Text then
				new.Text.Text = data.Text
				new.Text.Visible = true
				data.Text = nil
			end
			
			if data.Desc or data.ToolTip then
				new.Desc.Value = data.Desc or data.ToolTip
				data.Desc = nil
			end
			
			Expand(new, Tooltip)
		else
			if data.ToolTip then
				Expand(new, Tooltip, data.ToolTip)
			end
		end
		
		if class == "ButtonEntry" then
			local button = new.Button
			local debounce = false
			local onClicked = functionify(data.OnClicked, button)
			
			new:SetSpecial("DoClick",function()
				if not debounce then
					debounce = true
					if onClicked then
						onClicked(button)
					end
					debounce = false
				end
			end)
			
			new.Text = data.Text or new.Text
			button.ZIndex = data.ZIndex or new.ZIndex
			button.MouseButton1Down:connect(new.DoClick)
		end
		
		if class == "Boolean" then
			local enabled = data.Enabled
			local debounce = false
			local onToggle = functionify(data.OnToggle, new)
			local function toggle(isEnabled)
				if not debounce then
					debounce = true
					if (isEnabled ~= nil and isEnabled) or (isEnabled == nil and enabled) then
						enabled = false
						new.Text = "Disabled"
					elseif (isEnabled ~= nil and isEnabled == false) or (isEnabled == nil and not enabled) then
						enabled = true
						new.Text = "Enabled"
					end
					
					if onToggle then
						onToggle(enabled, new)
					end
					debounce = false
				end
			end
			
			--new.ZIndex = data.ZIndex
			new.Text = (enabled and "Enabled") or "Disabled"
			new.MouseButton1Down:connect(function()
				if onToggle then
					toggle()
				end
			end)
			
			new:SetSpecial("Toggle",function(ignore, isEnabled) toggle(isEnabled) end)
		end
		
		if class == "StringEntry" then
			local box = new.Box
			local ignore
			
			new.Text = data.Text or new.Text
			box.ZIndex = data.ZIndex or new.ZIndex
			
			if data.BoxText then
				box.Text = data.BoxText
			end
			
			if data.BoxProperties then
				for i,v in next,data.BoxProperties do
					if checkProperty(box, i) then
						box[i] = v
					end
				end
			end
			
			if data.TextChanged then
				local textChanged = functionify(data.TextChanged, box)
				box.Changed:connect(function(p)
					if p == "Text" and not ignore then
						textChanged(box.Text)
					end
				end)
				
				box.FocusLost:connect(function(enter)
					local change = textChanged(box.Text, true, enter)
					if change then
						ignore = true
						box.Text = change
						ignore = false
					end
				end)
			end
			
			new:SetSpecial("SetValue",function(ignore, newValue) box.Text = newValue end)
		end
		
		if class == "Slider" then
			local mouseIsIn = false
			local posValue = new.Percentage
			local slider = new.Slider
			local bar = new.SliderBar
			local drag = new.Drag
			local moving = false
			local value = 0
			local onSlide = functionify(data.OnSlide, new)
			
			bar.ZIndex = data.ZIndex or new.ZIndex
			slider.ZIndex = bar.ZIndex+1
			drag.ZIndex = slider.ZIndex+1
			drag.Active = true
			
			if data.Value then
				slider.Position = UDim2.new(0.5, -10, 0.5, -10)
				drag.Position = slider.Position
			end
			
			bar.InputBegan:connect(function(input)
				if not moving and input.UserInputType == Enum.UserInputType.MouseButton1 then
					value = ((Mouse.X)-(new.AbsolutePosition.X))/(new.AbsoluteSize.X)
					
					if value < 0 then
						value = 0
					elseif value > 1 then
						value = 1
					end
					
					slider.Position = UDim2.new(value, -10, 0.5, -10)
					drag.Position = slider.Position
					posValue.Value = value
					
					if onSlide then
						onSlide(value)
					end
				end
			end)
			
			drag.DragBegin:connect(function()
				moving = true
			end)
			
			drag.DragStopped:connect(function()
				moving = false
				drag.Position = slider.Position
			end)
			
			drag.Changed:connect(function()
				if moving then
					value = ((Mouse.X)-(new.AbsolutePosition.X))/(new.AbsoluteSize.X)
					
					if value < 0 then
						value = 0
					elseif value > 1 then
						value = 1
					end
					
					slider.Position = UDim2.new(value, -10, 0.5, -10)
					posValue.Value = value
					
					if onSlide then
						onSlide(value)
					end
				end
			end)
			
			new:SetSpecial("SetValue",function(ignore, newValue) 
				if newValue and tonumber(newValue) then 
					value = tonumber(newValue)
					posValue.Value = value
					slider.Position = UDim2.new(value, -10, 0.5, -10)
					drag.Position = slider.Position
				end
			end)
		end
		
		if class == "Dropdown" then
			local menu = new.Menu
			local downImg = new.Down
			local selected = new.dSelected
			local options = data.Options
			local curSelected = data.Selected or data.Selection
			local onSelect = functionify(data.OnSelection or data.OnSelect or function()end)
			local textProps = data.TextProperties
			local scroller = create("ScrollingFrame", {
				Parent = menu;
				Size = UDim2.new(1, 0, 1, 0);
				Position = UDim2.new(0, 0, 0, 0);
				BackgroundTransparency = 1;
				ZIndex = 100;
			})
			
			menu.ZIndex = scroller.ZIndex
			menu.Parent = GUI
			menu.Visible = false
			menu.Size = UDim2.new(0, new.AbsoluteSize.X, 0, 100);
			menu.BackgroundColor3 = data.BackgroundColor3 or new.BackgroundColor3
			
			if data.TextAlignment then
				selected.TextXAlignment = data.TextAlignment
				selected.Position = UDim2.new(0, 30, 0, 0);
			end
			
			if data.NoArrow then
				downImg.Visible = false
			end
			
			new:SetSpecial("MenuContainer", menu)
			
			new.Changed:Connect(function(p)
				if p == "AbsolutePosition" and menu.Visible then
					menu.Position = UDim2.new(0, new.AbsolutePosition.X, 0, new.AbsolutePosition.Y+new.AbsoluteSize.Y)
				elseif p == "AbsoluteSize" or p == "Parent" then
					downImg.Size = UDim2.new(0, new.AbsoluteSize.Y, 1, 0);
					if data.TextAlignment == "Right" then
						downImg.Position = UDim2.new(0, 0, 0.5, -(downImg.AbsoluteSize.X/2))
						selected.Position = UDim2.new(0, new.AbsoluteSize.Y, 0, 0);
					else
						downImg.Position = UDim2.new(1, -downImg.AbsoluteSize.X, 0.5, -(downImg.AbsoluteSize.X/2))
					end
					
					selected.Size = UDim2.new(1, -downImg.AbsoluteSize.X, 1, 0);
					
					if options and #options <= 6 then
						menu.Size = UDim2.new(0, new.AbsoluteSize.X, 0, 30*#options);
					else
						menu.Size = UDim2.new(0, new.AbsoluteSize.X, 0, 30*6);
						scroller:ResizeCanvas(false, true);
					end
				end
			end)
			
			selected.ZIndex = new.ZIndex
			downImg.ZIndex = new.ZIndex
			
			if textProps then
				for i,v in next,textProps do
					selected[i] = v
				end
			end
			
			if options then
				for i,v in next,options do
					local button = scroller:Add("TextButton", {
						Text = "  ".. tostring(v);
						Size = UDim2.new(1, -10, 0, 30);
						Position = UDim2.new(0, 5, 0, 30*(i-1));
						ZIndex = menu.ZIndex;
						BackgroundTransparency = 1;
						OnClick = function()
							selected.Text = v;
							onSelect(v, new);
							menu.Visible = false
						end
					})
					
					if textProps then
						for i,v in next,textProps do
							button[i] = v
						end
					end
				end
				
				if curSelected then
					selected.Text = curSelected
				else
					selected.Text = "No Selection"
				end
				
				selected.MouseButton1Down:Connect(function()
					menu.Position = UDim2.new(0, new.AbsolutePosition.X, 0, new.AbsolutePosition.Y+new.AbsoluteSize.Y)
					menu.Visible = not menu.Visible
				end)
			end
		end
		
		if class == "TabFrame" then
			local buttons = create("ScrollingFrame", nil, new.Buttons)
			local frames = new.Frames
			local numTabs = 0
			local buttonSize = data.ButtonSize or 60
			
			new.BackgroundTransparency = data.BackgroundTransparency or 1
			buttons.ZIndex = data.ZIndex or new.ZIndex
			frames.ZIndex = buttons.ZIndex
			
			new:SetSpecial("GetTab", function(ignore, name)
				return frames:FindFirstChild(name)
			end)
			
			new:SetSpecial("NewTab", function(ignore, name, data)
				local data = data or {}
				--local numChildren = #frames:GetChildren()
				local nextPos = getNextPos(buttons);
				local textSize = service.TextService:GetTextSize(data.Text or name, dTextSize, dFont, buttons.AbsoluteSize)
				local oTextTrans = data.TextTransparency
				local isOpen = false
				local disabled = false
				local tabFrame = create("ScrollingFrame",{
					Name = name;
					Size = UDim2.new(1, 0, 1, 0);
					Position = UDim2.new(0, 0, 0, 0);
					BorderSizePixel = 0;
					BackgroundTransparency = data.FrameTransparency or data.Transparency;
					BackgroundColor3 = data.Color or dBackground:lerp(Color3.new(1,1,1), 0.2);
					ZIndex = buttons.ZIndex;
					Visible = false;
				})
				
				local tabButton = create("TextButton",{
					Name = name;
					Text = data.Text or name;
					Size = UDim2.new(0, textSize.X+20, 1, 0);
					ZIndex = buttons.ZIndex;
					Position = UDim2.new(0, (nextPos.X.Offset > 0 and nextPos.X.Offset+5) or 0, 0, 0);
					TextColor3 = data.TextColor;
					BackgroundTransparency = 0.7;
					TextTransparency = data.TextTransparency;
					BackgroundColor3 = data.Color or dBackground:lerp(Color3.new(1,1,1), 0.2);
					BorderSizePixel = 0;
				})
				
				tabFrame:SetSpecial("FocusTab",function()
					for i,v in next,buttons:GetChildren() do if isGui(v) then v.BackgroundTransparency = 0.7 v.TextTransparency = 0.7 end end
					for i,v in next,frames:GetChildren() do if isGui(v) then v.Visible = false end end
					tabButton.BackgroundTransparency = data.Transparency or 0
					tabButton.TextTransparency = data.TextTransparency or 0
					tabFrame.Visible = true
					if data.OnFocus then
						data.OnFocus(true)
					end
				end)
				
				if numTabs == 0 then
					tabFrame.Visible = true
					tabButton.BackgroundTransparency = data.Transparency or 0
				end
				
				tabButton.MouseButton1Down:connect(function()
					if not disabled then
						tabFrame:FocusTab()
					end
				end)
				
				tabButton.Parent = buttons
				tabFrame.Parent = frames
				buttons:ResizeCanvas(true, false)
				
				tabFrame:SetSpecial("Disable", function()
					disabled = true;
					tabButton.BackgroundTransparency = 0.9;
					tabButton.TextTransparency = 0.9
				end)
				
				tabFrame:SetSpecial("Enable", function()
					disabled = false;
					tabButton.BackgroundTransparency = 0.7;
					tabButton.TextTransparency = data.TextTransparency or 0;
				end)
				
				numTabs = numTabs+1;
				
				return tabFrame,tabButton
			end)
		end
		
		if class == "ScrollingFrame" then
			local genning = false
			if not data.ScrollBarThickness then
				data.ScrollBarThickness = dScrollBar
			end
			
			new:SetSpecial("GenerateList", function(obj, list, labelProperties, bottom)
				local list = list or obj;
				local genHold = {}
				local entProps = labelProperties or {}
				
				genning = genHold
				new:ClearAllChildren()
				
				local num = 0
				for i,v in next,list do
					local text = v;
					local desc;
					local color
					local richText;
					
					if type(v) == "table" then
						text = v.Text
						desc = v.Desc
						color = v.Color
						
						if v.RichTextAllowed or entProps.RichTextAllowed then
							richText = true
						end
					end
					
					local label = create("TextLabel",{
						Text = " "..tostring(text);
						ToolTip = desc;
						Size = UDim2.new(1,-5,0,(entProps.ySize or 20));
						Visible = true;
						BackgroundTransparency = 1;
						Font = "Arial";
						TextSize = 14;
						TextStrokeTransparency = 0.8;
						TextXAlignment = "Left";
						Position = UDim2.new(0,0,0,num*(entProps.ySize or 20));
						RichText = richText or false;
					})
					
					if color then
						label.TextColor3 = color
					end
					
					if labelProperties then
						for i,v in next,entProps do
							if checkProperty(label, i) then
								label[i] = v
							end
						end
					end
					
					if genning == genHold then
						label.Parent = new;
					else
						label:Destroy()
						break
					end
					
					num = num+1
					
					if data.Delay then 
						if type(data.Delay) == "number" then
							wait(data.Delay) 
						elseif i%100 == 0 then 
							wait(0.1) 
						end
					end
				end
				
				new:ResizeCanvas(false, true, false, bottom, 5, 5, 50)
				genning = nil
			end)
			
			new:SetSpecial("ResizeCanvas", function(ignore, onX, onY, xMax, yMax, xPadding, yPadding, modBreak)
				local xPadding,yPadding = data.xPadding or 5, data.yPadding or 5
				local newY, newX = 0,0
				
				if not onX and not onY then onX = false onY = true end
				for i,v in next,new:GetChildren() do
					if v:IsA("GuiObject") then
						if onY then
							v.Size = UDim2.new(v.Size.X.Scale, v.Size.X.Offset, 0, v.AbsoluteSize.Y)
							v.Position = UDim2.new(v.Position.X.Scale, v.Position.X.Offset, 0, v.AbsolutePosition.Y-new.AbsolutePosition.Y)
						end
						
						if onX then
							v.Size = UDim2.new(0, v.AbsoluteSize.X, v.Size.Y.Scale, v.Size.Y.Offset)
							v.Position = UDim2.new(0, v.AbsolutePosition.X-new.AbsolutePosition.X, v.Position.Y.Scale, v.Position.Y.Offset)
						end
						
						local yLower = v.Position.Y.Offset + v.Size.Y.Offset
						local xLower = v.Position.X.Offset + v.Size.X.Offset
						newY = math.max(newY, yLower)
						newX = math.max(newX, xLower)
						if modBreak then
							if i%modBreak == 0 then 
								wait(1/60)
							end
						end
					end
				end
				
				if onY then
					new.CanvasSize = UDim2.new(new.CanvasSize.X.Scale, new.CanvasSize.X.Offset, 0, newY+yPadding)
				end
				
				if onX then
					new.CanvasSize = UDim2.new(0, newX + xPadding, new.CanvasSize.Y.Scale, new.CanvasSize.Y.Offset)
				end
				
				if xMax then
					new.CanvasPosition = Vector2.new((newX + xPadding)-new.AbsoluteSize.X, new.CanvasPosition.Y)
				end
				
				if yMax then
					new.CanvasPosition = Vector2.new(new.CanvasPosition.X, (newY+yPadding)-new.AbsoluteSize.Y)
				end
			end)
			
			if data.List then new:GenerateList(data.List) data.List = nil end
		end
		
		LoadChildren(new, data.Content or data.Children)
		
		data.Children = nil
		data.Content = nil
		
		for i,v in next,data do
			if checkProperty(new, i) then
				new[i] = v
			end
		end
		
		new.Parent = parent
		
		return apiIfy(new, data, class),data
	end
	
	function apiIfy(gui, data, class)
		local newGui = service.Wrap(gui)
		gui:SetSpecial("Object", gui)
		gui:SetSpecial("SetPosition", function(ignore, newPos) gui.Position = newPos end)
		gui:SetSpecial("SetSize", function(ingore, newSize) gui.Size = newSize end)
		gui:SetSpecial("Add", function(ignore, class, data)
			if not data then data = class class = ignore end
			local new = create(class,data);
			new.Parent = gui;
			return apiIfy(new, data, class)
		end)
		
		gui:SetSpecial("Copy", function(ignore, class, gotData)
			local newData = {}
			local new
			
			for i,v in next,data do
				newData[i] = v
			end
			
			for i,v in next,gotData do
				newData[i] = v
			end
			
			new = create(class or data.Class or gui.ClassName, newData);
			new.Parent = gotData.Parent or gui.Parent;
			return apiIfy(new, data, class)
		end)
		
		return newGui
	end
	
	function doClose()
		if not isClosed then
			isClosed = true
			gTable:Destroy()
		end
	end
	
	function isVisible()
		return Main.Visible
	end
	
	function doHide(doHide)
		local origLH = Hide.LineHeight
		if doHide or (doHide == nil and Main.Visible) then
			dragSize = Drag.Size
			Main.Visible = false
			Drag.BackgroundTransparency = Main.BackgroundTransparency
			Drag.BackgroundColor3 = Main.BackgroundColor3
			Drag.Size = UDim2.new(0, 200, Drag.Size.Y.Scale, Drag.Size.Y.Offset)
			Hide.Text = "+"
			Hide.LineHeight = origLH
			gTable.Minimized = true
		elseif doHide == false or (doHide == nil and not Main.Visible) then
			Main.Visible = true
			Drag.BackgroundTransparency = 1
			Drag.Size = dragSize or Drag.Size
			Hide.Text = "-"
			Hide.LineHeight = origLH
			gTable.Minimized = false
		end
		
		if onMinimize then
			onMinimize(Main.Visible)
		end
		
		if Walls then
			wallPosition()
		end
	end
	
	function isInFrame(x, y, frame)
		if x > frame.AbsolutePosition.X and x < (frame.AbsolutePosition.X+frame.AbsoluteSize.X) and y > frame.AbsolutePosition.Y and y < (frame.AbsolutePosition.Y+frame.AbsoluteSize.Y) then
			return true
		else
			return false
		end
	end
	
	function wallPosition()
		if gTable.Active then
			local x,y = Drag.AbsolutePosition.X, Drag.AbsolutePosition.Y
			local abx, gx, gy = Drag.AbsoluteSize.X, GUI.AbsoluteSize.X, GUI.AbsoluteSize.Y
			local ySize = (Main.Visible and Main.AbsoluteSize.Y) or Drag.AbsoluteSize.Y
			
			if x < 0 then
				Drag.Position = UDim2.new(0, 0, Drag.Position.Y.Scale, Drag.Position.Y.Offset)
			end
			
			if y < 0 then
				Drag.Position = UDim2.new(Drag.Position.X.Scale, Drag.Position.X.Offset, 0, 0)
			end
			
			if x + abx > gx then
				Drag.Position = UDim2.new(0, GUI.AbsoluteSize.X - Drag.AbsoluteSize.X, Drag.Position.Y.Scale, Drag.Position.Y.Offset)
			end
			
			if y + ySize > gy then
				Drag.Position = UDim2.new(Drag.Position.X.Scale, Drag.Position.X.Offset, 0, GUI.AbsoluteSize.Y - ySize)
			end
		end
	end
	
	function setSize(newSize)
		if newSize and type(newSize) == "table" then
			if newSize[1] < 50 then newSize[1] = 50 end
			if newSize[2] < 50 then newSize[2] = 50 end
			
			Drag.Size = UDim2.new(0,newSize[1],0,25)
			Main.Size = UDim2.new(1,0,0,newSize[2])
		end 
	end
	
	function setPosition(newPos)
		if newPos and typeof(newPos) == "UDim2" then
			Drag.Position = newPos
		elseif newPos and type(newPos) == "table" then
			Drag.Position = UDim2.new(0, newPos[1], 0, newPos[2])
		elseif Size and not newPos then
			Drag.Position = UDim2.new(0.5, -Drag.AbsoluteSize.X/2, 0.5, -Main.AbsoluteSize.Y/2)
		end 
	end
	
	if Name then
		gTable.Name = Name
		if data.AllowMultiple ~= nil and data.AllowMultiple == false then
			local found, num = client.UI.Get(Name, GUI, true)
			if found then
				doClose()
				return nil
			end
		end
	end
	
	if Size then
		setSize(Size)
	end
	
	if Position then
		setPosition(Position)
	end 
	
	if Title then
		Titlef.Text = Title
	end
	
	if CanKeepAlive or not ResetOnSpawn then
		gTable.CanKeepAlive = true
		GUI.ResetOnSpawn = false
	elseif ResetOnSpawn then
		gTable.CanKeepAlive = false
		GUI.ResetOnSpawn = true
	end
	
	if Icon then
		Iconf.Visible = true
		Iconf.Image = Icon
	end
	
	if CanvasSize then
		ScrollFrame.CanvasSize = CanvasSize
	end
	
	if noClose then
		Close.Visible = false
		Refresh.Position = Hide.Position
		Hide.Position = Close.Position
	end
	
	if noHide then
		Hide.Visible = false
		Refresh.Position = Hide.Position
	end
	
	if Walls then
		Drag.DragStopped:connect(function()
			wallPosition()
		end)
	end
	
	if onRefresh then
		local debounce = false
		function DoRefresh()
			if not Refreshing then
				local done = false
				Refreshing = true
				
				spawn(function()
					while gTable.Active and not done do
						for i = 0,180,10 do
							rSpinner.Rotation = -i
							wait(1/60)
						end
					end
				end)
				
				onRefresh()
				wait(1)
				done = true
				Refreshing = false
			end
		end
		
		Refresh.MouseButton1Down:connect(function()
			if not debounce then
				debounce = true
				DoRefresh()
				debounce = false
			end
		end)
		
		Titlef.Size = UDim2.new(1, -130, Titlef.Size.Y.Scale, Titlef.Size.Y.Offset)
	else
		Refresh.Visible = false
	end
	
	if iconClicked then
		Iconf.MouseButton1Down(function()
			iconClicked(data, GUI, Iconf)
		end)
	end
	
	if Menu then
		data.Menu.Text     = ""
		data.Menu.Parent   = Main
		data.Menu.Size     = UDim2.new(1,-10,0,25)
		data.Menu.Position = UDim2.new(0,5,0,25)
		ScrollFrame.Size   = UDim2.new(1,-10,1,-55)
		ScrollFrame.Position       = UDim2.new(0,5,0,50)
		data.Menu.BackgroundColor3 = Color3.fromRGB(216, 216, 216)
		data.Menu.BorderSizePixel  = 0
		create("TextLabel",data.Menu)
	end
	
	if not SizeLocked then
		local startXPos = Drag.AbsolutePosition.X
		local startYPos = Drag.AbsolutePosition.Y
		local startXSize = Drag.AbsoluteSize.X
		local startYSize = Drag.AbsoluteSize.Y
		local vars = client.Variables
		local newIcon
		local inFrame
		local ReallyInFrame
		
		local function readify(obj)
			obj.MouseEnter:connect(function()
				ReallyInFrame = obj
			end)
			
			obj.MouseLeave:connect(function()
				if ReallyInFrame == obj then
					ReallyInFrame = nil
				end
			end)
		end
		
		--[[
		readify(Drag)
		readify(ScrollFrame)
		readify(TopRight)
		readify(TopLeft)
		readify(RightCorner)
		readify(LeftCorner)
		readify(RightSide)
		readify(LeftSide)
		readify(Bottom)
		readify(Top)
		--]]
		
		function checkMouse(x, y) --// Update later to remove frame by frame pos checking
			if gTable.Active and Main.Visible then 
				if isInFrame(x, y, Drag) or isInFrame(x, y, ScrollFrame) then
					inFrame = nil
					newIcon = nil
				elseif isInFrame(x, y, TopRight) then
					inFrame = "TopRight"
					newIcon = MouseIcons.TopRight
				elseif isInFrame(x, y, TopLeft) then
					inFrame = "TopLeft"
					newIcon = MouseIcons.TopLeft
				elseif isInFrame(x, y, RightCorner) then
					inFrame = "RightCorner"
					newIcon = MouseIcons.RightCorner
				elseif isInFrame(x, y, LeftCorner) then
					inFrame = "LeftCorner"
					newIcon = MouseIcons.LeftCorner
				elseif isInFrame(x, y, RightSide) then
					inFrame = "RightSide"
					newIcon = MouseIcons.Horizontal
				elseif isInFrame(x, y, LeftSide) then
					inFrame = "LeftSide"
					newIcon = MouseIcons.Horizontal
				elseif isInFrame(x, y, Bottom) then
					inFrame = "Bottom"
					newIcon = MouseIcons.Vertical
				elseif isInFrame(x, y, Top) then
					inFrame = "Top"
					newIcon = MouseIcons.Vertical
				else
					inFrame = nil
					newIcon = nil
				end
			else
				inFrame = nil
			end
			
			if (not client.Variables.MouseLockedBy) or client.Variables.MouseLockedBy == gTable then
				if inFrame and newIcon then
					Mouse.Icon = newIcon
					client.Variables.MouseLockedBy = gTable
				elseif client.Variables.MouseLockedBy == gTable then
					Mouse.Icon = curIcon
					client.Variables.MouseLockedBy = nil
				end
			end
		end
		
		local function inputStart(x, y)
			checkMouse(x, y)
			if gTable.Active and inFrame and not Resizing and not isInFrame(x, y, ScrollFrame) and not isInFrame(x, y, Drag) then
				Resizing = inFrame
				startXPos = Drag.AbsolutePosition.X
				startYPos = Drag.AbsolutePosition.Y
				startXSize = Drag.AbsoluteSize.X
				startYSize = Main.AbsoluteSize.Y
			end
		end
		
		local function inputEnd()
			if gTable.Active then
				if Resizing and onResize then
					onResize(UDim2.new(Drag.Size.X.Scale, Drag.Size.X.Offset, Main.Size.Y.Scale, Main.Size.Y.Offset))
				end
				
				Resizing = nil
				Mouse.Icon = curIcon
				--DragEnabled = true
				--if Walls then
				--	wallPosition()
				--end
			end
		end
		
		local function inputMoved(x, y)
			if gTable.Active then
				if Mouse.Icon ~= MouseIcons.TopRight and Mouse.Icon ~= MouseIcons.TopLeft and Mouse.Icon ~= MouseIcons.RightCorner and Mouse.Icon ~= MouseIcons.LeftCorner and Mouse.Icon ~= MouseIcons.Horizontal and Mouse.Icon ~= MouseIcons.Vertical then
					curIcon = Mouse.Icon
				end
				
				if Resizing then
					local moveX = false
					local moveY = false
					local newPos = Drag.Position
					local xPos, yPos = x, y
					local newX, newY = startXSize, startYSize
					
					--DragEnabled = false
					
					if Resizing == "TopRight" then
						newX = (xPos - startXPos) + 3
						newY = (startYPos - yPos) + startYSize -1
						moveY = true
					elseif Resizing == "TopLeft" then
						newX = (startXPos - xPos) + startXSize -1
						newY = (startYPos - yPos) + startYSize -1
						moveY = true
						moveX = true
					elseif Resizing == "RightCorner" then
						newX = (xPos - startXPos) + 3
						newY = (yPos - startYPos) + 3
					elseif Resizing == "LeftCorner" then
						newX = (startXPos - xPos) + startXSize + 3
						newY = (yPos - startYPos) + 3
						moveX = true
					elseif Resizing == "LeftSide" then
						newX = (startXPos - xPos) + startXSize + 3
						newY = startYSize
						moveX = true
					elseif Resizing == "RightSide" then
						newX = (xPos - startXPos) + 3
						newY = startYSize
					elseif Resizing == "Bottom" then
						newX = startXSize
						newY = (yPos - startYPos) + 3
					elseif Resizing == "Top" then
						newX = startXSize
						newY = (startYPos - yPos) + startYSize - 1
						moveY = true
					end
					
					if newX < MinSize[1] then newX = MinSize[1]  end
					if newY < MinSize[2] then newY = MinSize[2] end
					if newX > MaxSize[1] then newX = MaxSize[1] end
					if newY > MaxSize[2] then newY = MaxSize[2] end
					
					if moveX then
						newPos = UDim2.new(0, (startXPos+startXSize)-newX, newPos.Y.Scale, newPos.Y.Offset)
					end
					
					if moveY then
						newPos  = UDim2.new(newPos.X.Scale, newPos.X.Offset, 0, (startYPos+startYSize)-newY)
					end
					
					Drag.Position = newPos
					Drag.Size = UDim2.new(0, newX, Drag.Size.Y.Scale, Drag.Size.Y.Offset)
					Main.Size = UDim2.new(Main.Size.X.Scale, Main.Size.X.Offset, 0, newY)
					
					if not Titlef.TextFits then
						Titlef.Visible = false
					else
						Titlef.Visible = true
					end
				else
					checkMouse(x, y)
				end
			end
		end
		
		Event(InputService.InputBegan, function(input, gameHandled)
			if not gameHandled and (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then
				inputStart(Mouse.X, Mouse.Y)
			end
		end)
		
		Event(InputService.InputChanged, function(input, gameHandled)
			if (input.UserInputType == Enum.UserInputType.MouseMovement or Enum.UserInputType.Touch) then
				inputMoved(input.Position.X, input.Position.Y)
			end
		end)
		
		Event(InputService.InputEnded, function(input, gameHandled)
			if (input.UserInputType == Enum.UserInputType.MouseButton1 or Enum.UserInputType.Touch) then
				inputEnd()
			end
		end)
		
		--[[Event(Mouse.Button1Down, function()
			if gTable.Active and inFrame and not Resizing and not isInFrame(Mouse.X, Mouse.Y, ScrollFrame) and not isInFrame(Mouse.X, Mouse.Y, Drag) then
				Resizing = inFrame
				startXPos = Drag.AbsolutePosition.X
				startYPos = Drag.AbsolutePosition.Y
				startXSize = Drag.AbsoluteSize.X
				startYSize = Main.AbsoluteSize.Y
				checkMouse()
			end
		end)
		
		Event(Mouse.Button1Up, function()
			if gTable.Active then
				if Resizing and onResize then
					onResize(UDim2.new(Drag.Size.X.Scale, Drag.Size.X.Offset, Main.Size.Y.Scale, Main.Size.Y.Offset))
				end
				
				Resizing = nil
				Mouse.Icon = curIcon
				--if Walls then
				--	wallPosition()
				--end
			end
		end)--]]
	else
		LeftSizeIcon.Visible  = false
		RightSizeIcon.Visible = false
	end
	
	
	Close.MouseButton1Down:connect(doClose)
	Hide.MouseButton1Down:connect(function() doHide() end)
	gTable.CustomDestroy = function()
		service.UnWrap(GUI):Destroy()
		if client.Variables.MouseLockedBy == gTable then
			Mouse.Icon = curIcon
			client.Variables.MouseLockedBy = nil
		end
		
		if not isClosed then
			isClosed = true
			if onClose then
				onClose()
			end
		end
	end
	
	for i,child in next,GUI:GetChildren() do
		if child.Name ~= "Desc" and child.Name ~= "Drag" then
			specialInsts[child.Name] = child
			child.Parent = nil
		end
	end
	
	--// Drag & DisplayOrder Handler
	do
		local windowValue = Instance.new("BoolValue", GUI)
		local dragDragging = false
		local dragOffset
		local inFrame
		
		windowValue.Name = "__ADONIS_WINDOW"
		
		Event(Main.InputBegan, function(input)
			if gTable.Active and (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then
				BringToFront()
			end
		end)
		
		Event(Drag.InputBegan, function(input)
			if gTable.Active then
				inFrame = true
				
				if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then
					BringToFront()
				end
			end
		end)
		
		Event(Drag.InputChanged, function(input)
			if gTable.Active then
				inFrame = true
			end
		end)
		
		Event(Drag.InputEnded, function(input)
			inFrame = false
		end)
		
		Event(InputService.InputBegan, function(input)
			if inFrame and GUI.DisplayOrder == 101 and not dragDragging and (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then--isInFrame(input.Position.X, input.Position.Y, object) then
				dragDragging = true
				BringToFront()
				dragOffset = Vector2.new(Drag.AbsolutePosition.X - input.Position.X, Drag.AbsolutePosition.Y - input.Position.Y)
			end
		end)
		
		Event(InputService.InputChanged, function(input)
			if dragDragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then
				Drag.Position = UDim2.new(0, dragOffset.X + input.Position.X, 0, dragOffset.Y + input.Position.Y)
			end
		end)
		
		Event(InputService.InputEnded, function(input)
			if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then
				dragDragging = false
			end
		end)
	end

	--// Finishing up
	local api = apiIfy(ScrollFrame, data)
	local meta = api:GetMetatable()
	local oldNewIndex = meta.__newindex
	local oldIndex = meta.__index
	
	create("ScrollingFrame", nil, ScrollFrame)
	LoadChildren(api, Content)
	
	api:SetSpecial("gTable", gTable)
	api:SetSpecial("Window", GUI)
	api:SetSpecial("Main", Main)
	api:SetSpecial("Title", Titlef)
	api:SetSpecial("Dragger", Drag)
	api:SetSpecial("Destroy", doClose)
	api:SetSpecial("Close", doClose)
	api:SetSpecial("Object", ScrollFrame)
	api:SetSpecial("Refresh", DoRefresh) 
	api:SetSpecial("AddTitleButton", function(ignore, data) if type(ignore) == "table" and not data then data = ignore end return addTitleButton(data) end)
	api:SetSpecial("Ready", function() if onReady then onReady() end gTable.Ready() BringToFront() end)
	api:SetSpecial("BindEvent", function(ignore, ...) Event(...) end)	
	api:SetSpecial("Hide", function(ignore, hide) doHide(hide) end)
	api:SetSpecial("SetTitle", function(ignore, newTitle) Titlef.Text = newTitle end)
	api:SetSpecial("SetPosition", function(ignore, newPos) setPosition(newPos) end)
	api:SetSpecial("SetSize", function(ignore, newSize) setSize(newSize) end)
	api:SetSpecial("GetPosition", function() return Drag.AbsolutePosition end)
	api:SetSpecial("GetSize", function() return Main.AbsoluteSize end)
	api:SetSpecial("IsVisible", isVisible)
	api:SetSpecial("IsClosed", isClosed)
	
	meta.__index = function(tab, ind)
		if ind == "IsVisible" then
			return isVisible()
		elseif ind == "Closed" then
			return isClosed
		else
			return oldIndex(tab, ind)
		end
	end
	
	setSize(Size)
	setPosition(Position)
	
	if Ready then
		gTable:Ready()
		BringToFront()
	end
	
	return api,GUI
end
