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

return function(data, env)
	if env then
		setfenv(1, env)
	end
	--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
			local rounder = service.New("UICorner",{
				CornerRadius = UDim.new(0,5.5);
				Parent = point;
			});

			ent.MouseLeave:Connect(function(x,y)
				if inExpandable == ent then
					point.Visible = false
				end
			end)

			ent.MouseMoved:Connect(function(x,y)
				inExpandable = ent

				local text = text or ent.Desc.Value
				label.Text = text
				label.Font = Enum.Font.Gotham
				label.TextSize = 15
				label.TextStrokeTransparency = 1
				local sizeText = label.ContentText

				local maxWidth = 400
				local bounds = service.TextService:GetTextSize(sizeText, label.TextSize, label.Font, Vector2.new(maxWidth, math.huge))

				local sizeX, sizeY = bounds.X + 10, bounds.Y + 10
				local posX = (x + 6 + sizeX) < GUI.AbsoluteSize.X and (x + 6) or (x - 6 - sizeX)
				local posY = (y - 6 - sizeY) > 0 and (y - 6 - sizeY) or (y)

				point.Size = UDim2.new(0, sizeX, 0, sizeY)
				point.Position = UDim2.new(0, posX, 0, posY)

				point.BackgroundColor3 = Color3.fromRGB(26, 26, 26)



				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.Font = Enum.Font.Gotham
		data.Parent = Drag

		--local round = Drag.Close.UICorner:Clone()
	--	round.Parent = data
		--data.TextXAlignment = data.TextXAlignment or original.TextXAlignment
		--data.TextYAlignment = data.TextYAlignment or original.TextYAlignment


		local instancefinally = create("TextButton", data)
		local rounder = service.New("UICorner",{
			CornerRadius = UDim.new(0.2,0);
			Parent = instancefinally;
		});
		return instancefinally
	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 = "Gotham"
			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 not data.ClearTextOnFocus and class == "TextBox" then
				new.ClearTextOnFocus = false
			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 (class == "TextButton" or class == "TextLabel") then
				if not data.TextTruncate then
					data.TextTruncate = Enum.TextTruncate.AtEnd
					-- Truncate Text by default because looks weird if Expertcoderz hasn't implemented a proper min window size
				end
			end

			if (data.OnClicked or data.OnClick) and (class == "TextButton" or class == "ImageButton") 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"
						new.TextColor3 = Color3.fromRGB(243, 64, 10)
					elseif (isEnabled ~= nil and isEnabled == false) or (isEnabled == nil and not enabled) then
						enabled = true
						new.Text = "Enabled"
						new.TextColor3 = Color3.fromRGB(40, 243, 97)
					end

					if onToggle then
						onToggle(enabled, new)
					end
					debounce = false
				end
			end
			--new.ZIndex = data.ZIndex
			new.Text = (enabled and "Enabled") or "Disabled"
			new.TextColor3 = (enabled and Color3.fromRGB(40, 243, 97)) or Color3.fromRGB(243, 64, 10)

			new.MouseButton1Down:Connect(function()
				if onToggle then
					toggle()
				end
			end)

			new:SetSpecial("Toggle",function(ignore, isEnabled) toggle(isEnabled) end)
		end
		if class == "TextString" then
			local enabled = data.Text
			local ColorText = data.ColorText
			local onToggle = functionify(data.OnToggle, new)

			--new.ZIndex = data.ZIndex
			new.Text = enabled
			new.TextColor3 = ColorText
		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 or input.UserInputType == Enum.UserInputType.Touch) then
					value = ((input.Position.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 = Color3.fromRGB(24, 24, 24);
					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;
					Font = Enum.Font.Gotham;
					BackgroundTransparency = 0.7;
					TextTransparency = data.TextTransparency;
					BackgroundColor3 = Color3.fromRGB(24, 24, 24);
					BorderSizePixel = 0;
				})
				local round1 = Instance.new("UICorner")
				round1.Parent = tabButton
				round1.CornerRadius = UDim.new(0.2,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)
				local round2 = Instance.new("UICorner")
				round2.Parent = tabFrame
				round2.CornerRadius = UDim.new(0.2,0)
				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 = "Gotham";
						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.Parent.Minimized.Visible = true
			Main.Visible = false
			Drag.BackgroundColor3 = Main.BackgroundColor3
			Drag.Size = dragSize or Drag.Size

			Hide.Outer.Image = "rbxassetid://7472853084"
			--Hide.Text = ""
			Hide.LineHeight = origLH
			gTable.Minimized = true
		elseif doHide == false or (doHide == nil and not Main.Visible) then
			Main.Visible = true
			Main.Parent.Minimized.Visible = false
			Drag.Size = dragSize or Drag.Size
			Hide.Outer.Image = "rbxassetid://7462814901"
			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
				local Position = input.Position
				inputStart(Position.X, Position.Y)
			end
		end)

		Event(InputService.InputChanged, function(input, gameHandled)
			if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
				local Position = input.Position
				inputMoved(Position.X, Position.Y)
			end
		end)

		Event(InputService.InputEnded, function(input, gameHandled)
			if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == 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
