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

	local function RippleEffect(element)
		spawn(function()
			element.ClipsDescendants = true
			local effect = create("ImageLabel", {
				Parent = element,
				AnchorPoint = Vector2.new(0.5, 0.5),
				BorderSizePixel = 0,
				ZIndex = element.ZIndex + 1,
				BackgroundTransparency = 0.5,
				ImageTransparency = 0.8,
				Image = "rbxasset://textures/whiteCircle.png",
				Position = UDim2.new(0.5, 0, 0.5, 0),
			})
			effect:TweenSize(UDim2.new(0, element.AbsoluteSize.X * 2.5, 0, element.AbsoluteSize.X * 2.5), Enum.EasingDirection.Out, Enum.EasingStyle.Linear, 0.2)
			wait(0.2)
			effect:Destroy()
		end)
	end

	local clickSound = service.New("Sound")
	clickSound.Parent = GUI.Drag
	clickSound.Volume = 0.4
	clickSound.SoundId = "rbxassetid://6706935653"

	Main.DescendantAdded:Connect(function(child)
		if child:IsA("TextButton") and not child:FindFirstChildOfClass("UIGradient") then
			local gradient = Instance.new("UIGradient", child)
			gradient.Color = ColorSequence.new{ColorSequenceKeypoint.new(0,Color3.new(1,1,1)),ColorSequenceKeypoint.new(1,Color3.fromRGB(80,80,80))}
			--[[create("ImageLabel", {
				BackgroundTransparency = 1;
				ImageTransparency = 0.5;
				Image = "rbxassetid://456420746";  -- For dusty Aero :]
				Size = UDim2.new(1, 0, 1, 0);
				Parent = child;
				ZIndex = 2
			})]]
		end
	end)

	function Expand(ent, point, text)
		local label = point:FindFirstChild("Label")

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

			ent.MouseMoved:Connect(function(x,y)
				inExpandable = ent
				label.Text = text or ent.Desc.Value
				--point.Size = UDim2.new(0, 10000, 0, 10000)
				local newx = 500
				local bounds = service.TextService:GetTextSize(text or ent.Desc.Value, label.TextSize, label.Font, Vector2.new(1000,1000)).X-- point.Label.TextBounds.X
				local rows = math.floor(bounds/500)
				rows = rows+1
				if rows<1 then rows = 1 end
				if bounds<500 then newx = bounds end
				point.Size = UDim2.new(0, newx+10, 0, (rows*20)+10)
				point.Position = UDim2.new(0, x+6, 0, y-40-((rows*20)+10))
				point.Visible = true
			end)
		end
	end

	function getNextPos(frame)
		local farXChild, farYChild
		for i,v in next,frame:GetChildren() do
			if checkProperty(v, "Size") then
				if not farXChild or (v.AbsolutePosition.X + v.AbsoluteSize.X) > (farXChild.AbsolutePosition.X + farXChild.AbsoluteSize.X) then
					farXChild = v
				end

				if not farYChild or (v.AbsolutePosition.Y + v.AbsoluteSize.Y) > (farXChild.AbsolutePosition.Y + farXChild.AbsoluteSize.Y) then
					farYChild = v
				end
			end
		end

		return ((not farXChild or not farYChild) and UDim2.new(0,0,0,0)) or UDim2.new(farXChild.Position.X.Scale, farXChild.Position.X.Offset + farXChild.AbsoluteSize.X, farYChild.Position.Y.Scale, farYChild.Position.Y.Offset + farYChild.AbsoluteSize.Y)
	end

	function LoadChildren(Obj, Children)
		if Children then
			local runWhenDone = Children.RunWhenDone and functionify(Children.RunWhenDone, Obj)
			for class,data in next,Children do
				if type(data) == "table" then
					if not data.Parent then data.Parent = Obj end
					create(data.Class or data.ClassName or class, data)
				elseif type(data) == "function" or type(data) == "string" and not runWhenDone then
					runWhenDone = functionify(data, Obj)
				end
			end

			if runWhenDone then
				runWhenDone(Obj)
			end
		end
	end

	function BringToFront()
		for i,v in ipairs(Player.PlayerGui:GetChildren()) do
			if v:FindFirstChild("__ADONIS_WINDOW") then
				v.DisplayOrder = 100
			end
		end

		GUI.DisplayOrder = 101
	end

	function addTitleButton(data)
		local startPos = 1
		local realPos
		local new
		local original = Hide

		if Hide.Visible then
			startPos = startPos+1
		end

		if Close.Visible then
			startPos = startPos+1
		end

		if Refresh.Visible then
			startPos = startPos+1
		end

		realPos = UDim2.new(1, -(((30*startPos)+5)+(startPos-1)), 0, 3)
		data.Position = data.Position or realPos
		data.Size = data.Size or original.Size
		data.BackgroundColor3 = data.BackgroundColor3 or original.BackgroundColor3
		data.BackgroundTransparency = data.BackgroundTransparency or original.BackgroundTransparency
		data.BorderSizePixel = data.BorderSizePixel or original.BorderSizePixel
		data.ZIndex = data.ZIndex or original.ZIndex
		data.TextColor3 = data.TextColor3 or original.TextColor3
		data.TextScaled = data.TextScaled or original.TextScaled
		data.TextStrokeColor3 = data.TextStrokeColor3 or original.TextStrokeColor3
		data.TextSize = data.TextSize or original.TextSize
		data.TextTransparency = data.TextTransparency or original.TextTransparency
		data.TextStrokeTransparency = data.TextStrokeTransparency or original.TextStrokeTransparency
		data.TextScaled = data.TextScaled or original.TextScaled
		data.TextWrapped = data.TextWrapped or original.TextWrapped
		--data.TextXAlignment = data.TextXAlignment or original.TextXAlignment
		--data.TextYAlignment = data.TextYAlignment or original.TextYAlignment
		data.Font = data.Font or original.Font
		data.Parent = Drag

		local newTitleButton = create("TextButton", data)
		create("UICorner", {CornerRadius = UDim.new(0,4);Parent = newTitleButton})

		newTitleButton.MouseButton1Down:Connect(function() RippleEffect(newTitleButton) end)
		return newTitleButton
	end

	function functionify(func, object)
		if type(func) == "string" then
			if object then
				local env = GetEnv()
				env.Object = object
				return client.Core.LoadCode(func, env)
			else
				return client.Core.LoadCode(func)
			end
		else
			return func
		end
	end

	function create(class, dataFound, existing)
		local data = dataFound or {}
		local class = data.Class or data.ClassName or class
		local new = existing or (specialInsts[class] and specialInsts[class]:Clone()) or service.New(class)
		local parent = data.Parent or new.Parent

		if dataFound then
			data.Parent = nil

			if data.Class or data.ClassName then
				data.Class = nil
				data.ClassName = nil
			end

			if not data.BorderColor3 and checkProperty(new,"BorderColor3") then
				new.BorderColor3 = dBorder
			end

			if not data.CanvasSize and checkProperty(new,"CanvasSize") then
				new.CanvasSize = dCanvasSize
			end

			if not data.BorderSizePixel and checkProperty(new,"BorderSizePixel") then
				new.BorderSizePixel = dPixelSize
			end

			if not data.BackgroundColor3 and checkProperty(new,"BackgroundColor3") then
				new.BackgroundColor3 = dBackground
			end

			if not data.PlaceholderColor3 and checkProperty(new,"PlaceholderColor3") then
				new.PlaceholderColor3 = dPlaceholderColor
			end

			if not data.Transparency and not data.BackgroundTransparency and checkProperty(new,"Transparency") then
				new.BackgroundTransparency = dTransparency
			elseif data.Transparency then
				new.BackgroundTransparency = data.Transparency
			end

			if not data.TextColor3 and not data.TextColor and checkProperty(new,"TextColor3") then
				new.TextColor3 = dTextColor
			elseif data.TextColor then
				new.TextColor3 = data.TextColor
			end

			if not data.Font and checkProperty(new, "Font") then
				data.Font = dFont
			end

			if not data.TextSize and checkProperty(new, "TextSize") then
				data.TextSize = dTextSize
			end

			if not data.BottomImage and not data.MidImage and not data.TopImage and class == "ScrollingFrame" then
				new.BottomImage = dScrollImage
				new.MidImage = dScrollImage
				new.TopImage = dScrollImage
			end

			if not data.Size and checkProperty(new,"Size") then
				new.Size = dSize
			end

			if not data.Position and checkProperty(new,"Position") then
				new.Position = dPosition
			end

			if not data.ZIndex and checkProperty(new,"ZIndex") then
				new.ZIndex = dZIndex
				if parent and checkProperty(parent, "ZIndex") then
					new.ZIndex = parent.ZIndex
				end
			end

			if data.TextChanged and class == "TextBox" then
				local textChanged = functionify(data.TextChanged, new)
				new.FocusLost:Connect(function(enterPressed)
					textChanged(new.Text, enterPressed, new)
				end)
			end

			if (data.OnClicked or data.OnClick) and (class == "TextButton" 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

						RippleEffect(new)
						onClick(new);

						debounce = false;
					end
				end)
			end

			if data.Events then
				for event,func in pairs(data.Events) do
					local realFunc = functionify(func, new)
					Event(new[event], function(...)
						realFunc(...)
					end)
				end
			end

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

			if data.LabelProps then
				data.LabelProperties = data.LabelProps
			end
		end

		if class == "Entry" then
			local label = new.Text
			local dots = new.Dots
			local desc = new.Desc

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

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

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

			Expand(new, Tooltip)
		else
			if data.ToolTip then
				Expand(new, Tooltip, data.ToolTip)
			end
		end

		if class == "ButtonEntry" then
			local button = new.Button
			local debounce = false
			local onClicked = functionify(data.OnClicked, button)

			new:SetSpecial("DoClick",function()
				if not debounce then
					debounce = true
					if onClicked then
						onClicked(button)
					end
					debounce = false
				end
			end)

			new.Text = data.Text or new.Text
			button.ZIndex = data.ZIndex or new.ZIndex
			button.MouseButton1Down:Connect(function()
				clickSound:Play()
				RippleEffect(new)
				new.DoClick()
			end)
		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
					clickSound:Play()
					RippleEffect(new)
					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 or input.UserInputType == Enum.UserInputType.Touch) then
					value = ((input.Position.X) - (new.AbsolutePosition.X)) / (new.AbsoluteSize.X)

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

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

					if onSlide then
						onSlide(value)
					end
				end
			end)

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

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

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

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

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

					if onSlide then
						onSlide(value)
					end
				end
			end)

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

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

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

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

			if data.NoArrow then
				downImg.Visible = false
			end

			new:SetSpecial("MenuContainer", menu)

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

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

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

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

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

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

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

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

				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(function() clickSound:Play() RippleEffect(selected) showMenu() end)
				downImg.MouseButton1Down:Connect(function() RippleEffect(selected) showMenu() end)
			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()

				local num = 0
				for i,v in next,list do
					local text = v;
					local desc;
					local color
					local richText;

					if type(v) == "table" then
						text = v.Text
						desc = v.Desc
						color = v.Color

						if v.RichTextAllowed or entProps.RichTextAllowed then
							richText = true
						end
					end

					local label = create("TextLabel",{
						Text = " "..tostring(text);
						ToolTip = desc;
						Size = UDim2.new(1,-5,0,(entProps.ySize or 20));
						Visible = true;
						BackgroundTransparency = 1;
						Font = "SourceSans";
						TextSize = 18;
						TextStrokeTransparency = 0.8;
						TextXAlignment = "Left";
						Position = UDim2.new(0,0,0,num*(entProps.ySize or 20));
						RichText = richText or false;
					})

					if color then
						label.TextColor3 = color
					end

					if labelProperties then
						for i,v in next,entProps do
							if checkProperty(label, i) then
								label[i] = v
							end
						end
					end

					if genning == genHold then
						label.Parent = new;
					else
						label:Destroy()
						break
					end

					num = num+1

					if data.Delay then
						if type(data.Delay) == "number" then
							wait(data.Delay)
						elseif i%100 == 0 then
							wait(0.1)
						end
					end
				end

				new:ResizeCanvas(false, true, false, bottom, 5, 5, 50)
				genning = nil
			end)

			new:SetSpecial("ResizeCanvas", function(ignore, onX, onY, xMax, yMax, xPadding, yPadding, modBreak)
				local xPadding,yPadding = data.xPadding or 5, data.yPadding or 5
				local newY, newX = 0,0

				if not onX and not onY then onX = false onY = true end
				for i,v in next,new:GetChildren() do
					if v:IsA("GuiObject") then
						if onY then
							v.Size = UDim2.new(v.Size.X.Scale, v.Size.X.Offset, 0, v.AbsoluteSize.Y)
							v.Position = UDim2.new(v.Position.X.Scale, v.Position.X.Offset, 0, v.AbsolutePosition.Y-new.AbsolutePosition.Y)
						end

						if onX then
							v.Size = UDim2.new(0, v.AbsoluteSize.X, v.Size.Y.Scale, v.Size.Y.Offset)
							v.Position = UDim2.new(0, v.AbsolutePosition.X-new.AbsolutePosition.X, v.Position.Y.Scale, v.Position.Y.Offset)
						end

						local yLower = v.Position.Y.Offset + v.Size.Y.Offset
						local xLower = v.Position.X.Offset + v.Size.X.Offset
						newY = math.max(newY, yLower)
						newX = math.max(newX, xLower)
						if modBreak then
							if i%modBreak == 0 then
								wait(1/60)
							end
						end
					end
				end

				if onY then
					new.CanvasSize = UDim2.new(new.CanvasSize.X.Scale, new.CanvasSize.X.Offset, 0, newY+yPadding)
				end

				if onX then
					new.CanvasSize = UDim2.new(0, newX + xPadding, new.CanvasSize.Y.Scale, new.CanvasSize.Y.Offset)
				end

				if xMax then
					new.CanvasPosition = Vector2.new((newX + xPadding)-new.AbsoluteSize.X, new.CanvasPosition.Y)
				end

				if yMax then
					new.CanvasPosition = Vector2.new(new.CanvasPosition.X, (newY+yPadding)-new.AbsoluteSize.Y)
				end
			end)

			if data.List then new:GenerateList(data.List) data.List = nil end
		end

		LoadChildren(new, data.Content or data.Children)

		data.Children = nil
		data.Content = nil

		for i,v in next,data do
			if checkProperty(new, i) then
				new[i] = v
			end
		end

		new.Parent = parent

		return apiIfy(new, data, class),data
	end

	function apiIfy(gui, data, class)
		local newGui = service.Wrap(gui)
		gui:SetSpecial("Object", gui)
		gui:SetSpecial("SetPosition", function(ignore, newPos) gui.Position = newPos end)
		gui:SetSpecial("SetSize", function(ingore, newSize) gui.Size = newSize end)
		gui:SetSpecial("Add", function(ignore, class, data)
			if not data then data = class class = ignore end
			local new = create(class,data);
			new.Parent = gui;
			return apiIfy(new, data, class)
		end)

		gui:SetSpecial("Copy", function(ignore, class, gotData)
			local newData = {}
			local new

			for i,v in next,data do
				newData[i] = v
			end

			for i,v in next,gotData do
				newData[i] = v
			end

			new = create(class or data.Class or gui.ClassName, newData);
			new.Parent = gotData.Parent or gui.Parent;
			return apiIfy(new, data, class)
		end)

		return newGui
	end

	function doClose()
		if not isClosed then
			isClosed = true
			for _, thing in pairs(Drag:GetChildren()) do
				if thing ~= Main then
					thing:Destroy()
				end
			end
			Drag:TweenSize(UDim2.new(0,0,0,0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.15)
			Main.ClipsDescendants = true
			Main:TweenSize(UDim2.new(0,0,0,0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.15)
			wait(0.12)
			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
			Main.Glass.Parent = Drag
			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.Icon.Image = "rbxassetid://3523249191"
			else
				Hide.Icon.Image = "rbxassetid://3523249191"
			end

			Hide.LineHeight = origLH
			gTable.Minimized = true
		elseif doHide == false or (doHide == nil and not Main.Visible) then
			Main.Visible = true
			Drag.Glass.Parent = Main
			Drag.BackgroundTransparency = 1
			Drag.Size = dragSize or Drag.Size

			if hideLabel then
				hideLabel.Icon.Image = "rbxassetid://3523250728"
			else
				Hide.Icon.Image = "rbxassetid://3523250728"
			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
	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()
			clickSound:Play()
			RippleEffect(Refresh)
			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()
			clickSound:Play()
			RippleEffect(Iconf)
			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.MouseButton1Click:Connect(function() clickSound:Play() doClose() end)
	Hide.MouseButton1Click:Connect(function() clickSound:Play() doHide() end)

	Close.MouseButton1Down:Connect(function() RippleEffect(Close) end)
	Hide.MouseButton1Down:Connect(function() RippleEffect(Hide) end)

	gTable.CustomDestroy = function()
		service.UnWrap(GUI):Destroy()
		if client.Variables.MouseLockedBy == gTable then
			Mouse.Icon = curIcon
			client.Variables.MouseLockedBy = nil
		end

		if not isClosed then
			isClosed = true
			if onClose then
				onClose()
			end
		end
	end

	for i,child in next,GUI:GetChildren() do
		if child.Name ~= "Desc" and child.Name ~= "Drag" then
			specialInsts[child.Name] = child
			child.Parent = nil
		end
	end

	--// Drag & DisplayOrder Handler
	do
		local windowValue = Instance.new("BoolValue", GUI)
		local dragDragging = false
		local dragOffset
		local inFrame

		windowValue.Name = "__ADONIS_WINDOW"

		Event(Main.InputBegan, function(input)
			if gTable.Active and (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then
				BringToFront()
			end
		end)

		Event(Drag.InputBegan, function(input)
			if gTable.Active then
				inFrame = true

				if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
					BringToFront()
				end
			end
		end)

		Event(Drag.InputChanged, function(input)
			if gTable.Active then
				inFrame = true
			end
		end)

		Event(Drag.InputEnded, function(input)
			inFrame = false
		end)

		Event(InputService.InputBegan, function(input)
			if inFrame and GUI.DisplayOrder == 101 and not dragDragging and (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then--isInFrame(input.Position.X, input.Position.Y, object) then
				dragDragging = true
				BringToFront()
				dragOffset = Vector2.new(Drag.AbsolutePosition.X - input.Position.X, Drag.AbsolutePosition.Y - input.Position.Y)
			end
		end)

		Event(InputService.InputChanged, function(input)
			if dragDragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then
				Drag.Position = UDim2.new(0, dragOffset.X + input.Position.X, 0, dragOffset.Y + input.Position.Y)
			end
		end)

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

	--// Finishing up
	local api = apiIfy(ScrollFrame, data)
	local meta = api:GetMetatable()
	local oldNewIndex = meta.__newindex
	local oldIndex = meta.__index

	create("ScrollingFrame", nil, ScrollFrame)
	LoadChildren(api, Content)

	api:SetSpecial("gTable", gTable)
	api:SetSpecial("Window", GUI)
	api:SetSpecial("Main", Main)
	api:SetSpecial("Title", Titlef)
	api:SetSpecial("Dragger", Drag)
	api:SetSpecial("Destroy", doClose)
	api:SetSpecial("Close", doClose)
	api:SetSpecial("Object", ScrollFrame)
	api:SetSpecial("Refresh", DoRefresh)
	api:SetSpecial("AddTitleButton", function(ignore, data) if type(ignore) == "table" and not data then data = ignore end return addTitleButton(data) end)
	api:SetSpecial("Ready", function() if onReady then onReady() end gTable.Ready() BringToFront() end)
	api:SetSpecial("BindEvent", function(ignore, ...) Event(...) end)
	api:SetSpecial("Hide", function(ignore, hide) doHide(hide) end)
	api:SetSpecial("SetTitle", function(ignore, newTitle) Titlef.Text = newTitle end)
	api:SetSpecial("SetPosition", function(ignore, newPos) setPosition(newPos) end)
	api:SetSpecial("SetSize", function(ignore, newSize) setSize(newSize) end)
	api:SetSpecial("GetPosition", function() return Drag.AbsolutePosition end)
	api:SetSpecial("GetSize", function() return Main.AbsoluteSize end)
	api:SetSpecial("IsVisible", isVisible)
	api:SetSpecial("IsClosed", isClosed)

	meta.__index = function(tab, ind)
		if ind == "IsVisible" then
			return isVisible()
		elseif ind == "Closed" then
			return isClosed
		else
			return oldIndex(tab, ind)
		end
	end

	setSize(Size)
	setPosition(Position)

	if Ready then
		gTable:Ready()
		BringToFront()
	end

	return api,GUI
end
