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

	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, richText)
		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

				local text = text or ent.Desc.Value
				label.Text = text
				label.RichText = richText
				label.TextScaled = richText

				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.fromOffset(sizeX, sizeY)
				point.Position = UDim2.fromOffset(posX, posY)
				point.Visible = true
			end)
		end
	end

	function getNextPos(frame)
		local farXChild, farYChild
		for i,v in ipairs(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 pairs(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
		local diff = (Hide.AbsolutePosition.X + Hide.AbsoluteSize.X) - Close.AbsolutePosition.X;
		local far = Close;

		for i,obj in ipairs(Drag:GetChildren()) do
			if obj:IsA("TextButton") then
				if obj.Visible and obj.AbsolutePosition.X < far.AbsolutePosition.X then
					far = obj;
				end
			end
		end;

		local size = data.Size or original.Size;
		local xPos = far.Position.X.Offset - (size.X.Offset - diff);
		realPos = UDim2.new(far.Position.X.Scale, xPos, original.Position.Y.Scale, original.Position.Y.Offset)

		data.Name = "__TITLEBUTTON"
		data.Size = size
		data.Parent = Drag
		data.ZIndex = data.ZIndex or original.ZIndex
		data.Position = data.Position or realPos
		data.TextSize = data.TextSize or original.TextSize
		data.TextColor3 = data.TextColor3 or original.TextColor3
		data.TextScaled = data.TextScaled or original.TextScaled
		data.TextScaled = data.TextScaled or original.TextScaled
		data.TextWrapped = data.TextWrapped or original.TextWrapped
		data.TextStrokeColor3 = data.TextStrokeColor3 or original.TextStrokeColor3
		data.TextTransparency = data.TextTransparency or original.TextTransparency
		data.TextStrokeTransparency = data.TextStrokeTransparency or original.TextStrokeTransparency
		data.BackgroundTransparency = data.BackgroundTransparency or original.BackgroundTransparency
		data.BackgroundColor3 = data.BackgroundColor3 or original.BackgroundColor3
		data.BorderSizePixel = data.BorderSizePixel or original.BorderSizePixel
		--data.TextXAlignment = data.TextXAlignment or original.TextXAlignment
		--data.TextYAlignment = data.TextYAlignment or original.TextYAlignment
		data.Font = data.Font or original.Font

		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") and checkProperty(new, "BackgroundTransparency")  then
				new.BackgroundTransparency = dTransparency
			elseif data.Transparency and checkProperty(new, "BackgroundTransparency") 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" 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
			local richText = data.RichText or label.RichText

			label.ZIndex = data.ZIndex or new.ZIndex
			dots.ZIndex = data.ZIndex or new.ZIndex

			if data.Text then
				label.Text = data.Text
				label.Visible = true
				data.Text = nil
			end

			if data.Desc or data.ToolTip then
				desc.Value = data.Desc or data.ToolTip
				data.Desc = nil
			end

			Expand(new, Tooltip, nil, richText)
		else
			if data.ToolTip then
				Expand(new, Tooltip, data.ToolTip, data.RichText)
			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 pairs(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.fromScale(1, 1);
				Position = UDim2.new();
				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.fromOffset(30, 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.fromOffset(new.AbsolutePosition.X, 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.fromOffset(new.AbsoluteSize.Y, 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.fromOffset(new.AbsoluteSize.X, 30*#options);
					else
						menu.Size = UDim2.fromOffset(new.AbsoluteSize.X, 30*6);
						scroller:ResizeCanvas(false, true);
					end
				end
			end)

			selected.ZIndex = new.ZIndex
			downImg.ZIndex = new.ZIndex

			if textProps then
				for i,v in pairs(textProps) do
					selected[i] = v
				end
			end

			if options then
				for i,v in pairs(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 pairs(textProps) do
							button[i] = v
						end
					end
				end

				if curSelected then
					selected.Text = curSelected
				else
					selected.Text = "No Selection"
				end

				local function showMenu()
					menu.Position = UDim2.fromOffset(new.AbsolutePosition.X, new.AbsolutePosition.Y+new.AbsoluteSize.Y)
					menu.Visible = not menu.Visible
				end

				selected.MouseButton1Down:Connect(showMenu)
				downImg.MouseButton1Down:Connect(showMenu)
			end
		end

		if class == "TabFrame" then
			local buttonsTab = {};
			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.fromScale(1, 1);
					Position = UDim2.new();
					BorderSizePixel = 0;
					BackgroundTransparency = data.FrameTransparency or data.Transparency;
					BackgroundColor3 = data.Color or dSecondaryBackground;
					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 dSecondaryBackground;
					BorderSizePixel = 0;
				})

				tabFrame:SetSpecial("FocusTab",function()
					for i,v in ipairs(buttonsTab) do
						if isGui(v) then
							v.BackgroundTransparency = (v:IsDisabled() and 0.9) or 0.7
							v.TextTransparency = (v:IsDisabled() and 0.9) or 0.7
						end
					end

					for i,v in ipairs(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)

				tabButton:SetSpecial("IsDisabled", function()
					return disabled;
				end)

				table.insert(buttonsTab, tabButton);

				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()

				new.AutomaticCanvasSize = "Y"

				local layout = service.New("UIListLayout", {
					Parent = new;
					Name = "LayoutOrder";
					FillDirection = data.Layout_FillDirection or "Vertical";
					VerticalAlignment = data.Layout_VerticalAlignment or "Top";
					HorizontalAlignment = data.Layout_HorizontalAlignment or "Left";
				})

				local num = 0
				for i,v in pairs(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
					if v.TextSelectable or entProps.TextSelectable then
						label = create("TextBox",{
							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;
							TextEditable = false;
							ClearTextOnFocus = false;
						})
					else
						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;
						})
					end

					if color then
						label.TextColor3 = color
					end

					if labelProperties then
						for i,v in pairs(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)
				if bottom then
					new.CanvasPosition = Vector2.new(0, layout.AbsoluteContentSize.Y);
				end

				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 ipairs(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 pairs(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 pairs(data) do
				newData[i] = v
			end

			for i,v in pairs(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

			if onClose then
				local r,e = pcall(onClose)
				if e then
					warn(e)
				end
			end

			gTable:Destroy()
		end
	end

	function isVisible()
		return Main.Visible
	end

	local hideLabel = Hide:FindFirstChild("TextLabel")
	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)

			if hideLabel then
				hideLabel.Text = "+"
			else
				Hide.Text = "+"
			end

			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

			if hideLabel then
				hideLabel.Text = "-"
			else
				Hide.Text = "-"
			end

			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],Drag.Size.Y.Scale,Drag.Size.Y.Offset)
			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
		Iconf.Size = UDim2.new(0, 16, 0, 16)
		Iconf.Position = UDim2.new(0, 6, 0, 5)
		Iconf.ImageTransparency = 0
	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()
		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

		service.UnWrap(GUI):Destroy()
	end

	for i,child in ipairs(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.fromOffset(dragOffset.X + input.Position.X, 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
