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

			if data.TextChanged then
				local textChanged = functionify(data.TextChanged, box)
				box.Changed:Connect(function(p)
					if p == "Text" and not ignore then
						textChanged(box.Text)
					end
				end)

				box.FocusLost:Connect(function(enter)
					local change = textChanged(box.Text, true, enter)
					if change then
						ignore = true
						box.Text = change
						ignore = false
					end
				end)
			end

			new:SetSpecial("SetValue",function(ignore, newValue) box.Text = newValue end)
		end

		if class == "Slider" then
			local mouseIsIn = false
			local posValue = new.Percentage
			local slider = new.Slider
			local bar = new.SliderBar
			local drag = new.Drag
			local moving = false
			local value = 0
			local onSlide = functionify(data.OnSlide, new)

			bar.ZIndex = data.ZIndex or new.ZIndex
			slider.ZIndex = bar.ZIndex+1
			drag.ZIndex = slider.ZIndex+1
			drag.Active = true

			if data.Value then
				slider.Position = UDim2.new(0.5, -10, 0.5, -10)
				drag.Position = slider.Position
			end

			bar.InputBegan:Connect(function(input)
				if not moving and input.UserInputType == Enum.UserInputType.MouseButton1 then
					value = ((Mouse.X)-(new.AbsolutePosition.X))/(new.AbsoluteSize.X)

					if value < 0 then
						value = 0
					elseif value > 1 then
						value = 1
					end

					slider.Position = UDim2.new(value, -10, 0.5, -10)
					drag.Position = slider.Position
					posValue.Value = value

					if onSlide then
						onSlide(value)
					end
				end
			end)

			drag.DragBegin:Connect(function()
				moving = true
			end)

			drag.DragStopped:Connect(function()
				moving = false
				drag.Position = slider.Position
			end)

			drag.Changed:Connect(function()
				if moving then
					value = ((Mouse.X)-(new.AbsolutePosition.X))/(new.AbsoluteSize.X)

					if value < 0 then
						value = 0
					elseif value > 1 then
						value = 1
					end

					slider.Position = UDim2.new(value, -10, 0.5, -10)
					posValue.Value = value

					if onSlide then
						onSlide(value)
					end
				end
			end)

			new:SetSpecial("SetValue",function(ignore, newValue)
				if newValue and tonumber(newValue) then
					value = tonumber(newValue)
					posValue.Value = value
					slider.Position = UDim2.new(value, -10, 0.5, -10)
					drag.Position = slider.Position
				end
			end)
		end

		if class == "Dropdown" then
			local menu = new.Menu
			local downImg = new.Down
			local selected = new.dSelected
			local options = data.Options
			local curSelected = data.Selected or data.Selection
			local onSelect = functionify(data.OnSelection or data.OnSelect or function()end)
			local textProps = data.TextProperties
			local scroller = create("ScrollingFrame", {
				Parent = menu;
				Size = UDim2.new(1, 0, 1, 0);
				Position = UDim2.new(0, 0, 0, 0);
				BackgroundTransparency = 1;
				ZIndex = 100;
			})

			menu.ZIndex = scroller.ZIndex
			menu.Parent = GUI
			menu.Visible = false
			menu.Size = UDim2.new(0, new.AbsoluteSize.X, 0, 100);
			menu.BackgroundColor3 = data.BackgroundColor3 or new.BackgroundColor3

			if data.TextAlignment then
				selected.TextXAlignment = data.TextAlignment
				selected.Position = UDim2.new(0, 30, 0, 0);
			end

			if data.NoArrow then
				downImg.Visible = false
			end

			new:SetSpecial("MenuContainer", menu)

			new.Changed:Connect(function(p)
				if p == "AbsolutePosition" and menu.Visible then
					menu.Position = UDim2.new(0, new.AbsolutePosition.X, 0, new.AbsolutePosition.Y+new.AbsoluteSize.Y)
				elseif p == "AbsoluteSize" or p == "Parent" then
					downImg.Size = UDim2.new(0, new.AbsoluteSize.Y, 1, 0);
					if data.TextAlignment == "Right" then
						downImg.Position = UDim2.new(0, 0, 0.5, -(downImg.AbsoluteSize.X/2))
						selected.Position = UDim2.new(0, new.AbsoluteSize.Y, 0, 0);
					else
						downImg.Position = UDim2.new(1, -downImg.AbsoluteSize.X, 0.5, -(downImg.AbsoluteSize.X/2))
					end

					selected.Size = UDim2.new(1, -downImg.AbsoluteSize.X, 1, 0);

					if options and #options <= 6 then
						menu.Size = UDim2.new(0, new.AbsoluteSize.X, 0, 30*#options);
					else
						menu.Size = UDim2.new(0, new.AbsoluteSize.X, 0, 30*6);
						scroller:ResizeCanvas(false, true);
					end
				end
			end)

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

			if textProps then
				for i,v in next,textProps do
					selected[i] = v
				end
			end

			if options then
				for i,v in next,options do
					local button = scroller:Add("TextButton", {
						Text = "  ".. tostring(v);
						Size = UDim2.new(1, -10, 0, 30);
						Position = UDim2.new(0, 5, 0, 30*(i-1));
						ZIndex = menu.ZIndex;
						BackgroundTransparency = 1;
						OnClick = function()
							selected.Text = v;
							onSelect(v, new);
							menu.Visible = false
						end
					})

					if textProps then
						for i,v in next,textProps do
							button[i] = v
						end
					end
				end

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

				local function showMenu()
					menu.Position = UDim2.new(0, new.AbsolutePosition.X, 0, 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.new(1, 0, 1, 0);
					Position = UDim2.new(0, 0, 0, 0);
					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 next,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 next,frames:GetChildren() do
						if isGui(v) then
							v.Visible = false
						end
					end

					tabButton.BackgroundTransparency = data.Transparency or 0
					tabButton.TextTransparency = data.TextTransparency or 0
					tabFrame.Visible = true

					if data.OnFocus then
						data.OnFocus(true)
					end
				end)

				if numTabs == 0 then
					tabFrame.Visible = true
					tabButton.BackgroundTransparency = data.Transparency or 0
				end

				tabButton.MouseButton1Down:Connect(function()
					if not disabled then
						tabFrame:FocusTab()
					end
				end)

				tabButton.Parent = buttons
				tabFrame.Parent = frames
				buttons:ResizeCanvas(true, false)

				tabFrame:SetSpecial("Disable", function()
					disabled = true;
					tabButton.BackgroundTransparency = 0.9;
					tabButton.TextTransparency = 0.9
				end)

				tabFrame:SetSpecial("Enable", function()
					disabled = false;
					tabButton.BackgroundTransparency = 0.7;
					tabButton.TextTransparency = data.TextTransparency or 0;
				end)

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

			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
				inputStart(Mouse.X, Mouse.Y)
			end
		end)

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

		Event(InputService.InputEnded, function(input, gameHandled)
			if input.UserInputType == Enum.UserInputType.MouseButton1 or Enum.UserInputType.Touch then
				inputEnd()
			end
		end)

		--[[Event(Mouse.Button1Down, function()
			if gTable.Active and inFrame and not Resizing and not isInFrame(Mouse.X, Mouse.Y, ScrollFrame) and not isInFrame(Mouse.X, Mouse.Y, Drag) then
				Resizing = inFrame
				startXPos = Drag.AbsolutePosition.X
				startYPos = Drag.AbsolutePosition.Y
				startXSize = Drag.AbsoluteSize.X
				startYSize = Main.AbsoluteSize.Y
				checkMouse()
			end
		end)

		Event(Mouse.Button1Up, function()
			if gTable.Active then
				if Resizing and onResize then
					onResize(UDim2.new(Drag.Size.X.Scale, Drag.Size.X.Offset, Main.Size.Y.Scale, Main.Size.Y.Offset))
				end

				Resizing = nil
				Mouse.Icon = curIcon
				--if Walls then
				--	wallPosition()
				--end
			end
		end)--]]
	else
		LeftSizeIcon.Visible  = false
		RightSizeIcon.Visible = false
	end


	Close.MouseButton1Down:Connect(doClose)
	Hide.MouseButton1Down:Connect(function() doHide() end)
	gTable.CustomDestroy = function()
		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 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
