return function(i,D)local m=D(nil,{script=script})setfenv(1,m)local I,e,b,C,z,t,j,M,x,R,H,d,n,F,p,k,S,N,Q,h,J,K,Z,B,Y,A,y,G,X,V,u,f,U,w,g,s,r,E,P,W,T,L,q,o,O,c,v,a,l,ir,Dr,mr,Ir,er,br,Cr,zr,tr,jr=_G,game,script,getfenv,setfenv,workspace,getmetatable,setmetatable,loadstring,coroutine,rawequal,typeof,print,math,warn,error,pcall,xpcall,select,rawset,rawget,ipairs,pairs,next,Rect,Axes,os,time,Faces,unpack,string,Color3,newproxy,tostring,tonumber,Instance,TweenInfo,BrickColor,NumberRange,ColorSequence,NumberSequence,ColorSequenceKeypoint,NumberSequenceKeypoint,PhysicalProperties,Region3int16,Vector3int16,require,table,type,wait,Enum,UDim,UDim2,Vector2,Vector3,Region3,CFrame,Ray,delay local Mr=client.UIFolder local xr=b local Rr=i.Service local Hr=i.Client local dr=m.GetEnv local nr,Fr,pr,kr,Sr,Nr,Qr,hr local Jr,Kr local function Zr()Nr=Hr.UI nr=Hr.Anti Fr=Hr.Core Qr=Hr.Variables pr=Hr.Functions kr=Hr.Process Sr=Hr.Remote hr=Hr.Deps Jr=Rr.CloneTable Kr=Rr.TrackTask Nr.Init=nil end local function Br()Nr.DefaultTheme=Sr.Get("\083\101\116\116\105\110\103","\068\101\102\097\117\108\116\084\104\101\109\101")Nr.RunLast=nil end;(C()).client=nil;(C()).service=nil;(C()).script=nil Hr.UI={Init=Zr;RunLast=Br;GetHolder=function()if Nr.Holder and Nr.Holder.Parent==Rr.PlayerGui then return Nr.Holder else S(function()if Nr.Holder then Nr.Holder:Destroy()end end)local i=Rr.New("\083\099\114\101\101\110\071\117\105",{Name=pr.GetRandom();Parent=Rr.PlayerGui})Nr.Holder=i return Nr.Holder end end,Prepare=function(i)if true then return i end local D=Nr.Get(i,false,true)if i:IsA("\083\099\114\101\101\110\071\117\105")or i:IsA("\071\117\105\077\097\105\110")then local m=s.new("\084\101\120\116\076\097\098\101\108")m.BackgroundTransparency=1 m.Size=Ir.new(1,0,1,0)m.Name=i.Name m.Active=true m.Text=""for i,D in i:GetChildren()do D.Parent=m end if D then D:Register(m)end i:Destroy()return m else return i end end;LoadModule=function(i,D,m)D=D or{}local I,e=S(v,i)local b=dr(m,{script=i;client=Jr(Hr);service=Jr(Rr)})if b.service.Threads then b.service.Threads=Jr(Rr.Threads)end for i,D in b.client do if l(D)=="\116\097\098\108\101"and(i~="\086\097\114\105\097\098\108\101\115"and i~="\072\097\110\100\108\101\114\115")then b.client[i]=Jr(D)end end if I then local m={Kr("\085\073\058 "..i:GetFullName(),z(e,b),D,b)}if m[1]then return V(m,2)else p("\069\114\114\111\114 \119\104\105\108\101 \114\117\110\110\105\110\103 \109\111\100\117\108\101",i.Name,m[2])Hr.LogError("\069\114\114\111\114 \108\111\097\100\105\110\103 "..(i.Name..(" - "..w(m[2]))))end else p("\069\114\114\111\114 \119\104\105\108\101 \108\111\097\100\105\110\103 \109\111\100\117\108\101",i.Name,w(e))end end;GetNew=function(i,D)local m={}local I={}local e={}local b=s.new("\070\111\108\100\101\114")local C=false local function z(i,D,I)local e=(I or 11)-1 local b=Mr:FindFirstChild(i)or Mr.Default if b then local I=b:FindFirstChild("\066\097\115\101\095\084\104\101\109\101")local t=I and I.Value local j=b:FindFirstChild(D)if j then local e=j:FindFirstChild("\067\111\110\102\105\103")a.insert(m,{Theme=i;Folder=b,Name=D,Found=j,Config=e,isModule=j:IsA("\077\111\100\117\108\101\083\099\114\105\112\116")})if e then I=e:FindFirstChild("\066\097\115\101\084\104\101\109\101")or I t=I and I.Value end end if t and e>0 then if Nr.DefaultTheme and(t=="\068\101\102\097\117\108\116"and(i~=Nr.DefaultTheme and not C))then z(Nr.DefaultTheme,D,e)else C=true z(t,D,e)end end end end z(i,D)b.Name="\067\111\110\102\105\103"if#m>0 then for i,D in m do if D.Config then for i,D in D.Config:GetChildren()do if not I[D.Name]then if u.sub(D.Name,1,5)=="\078\111\069\110\118"then I.Code=D end I[D.Name]=D end end end end for i,D in I do(D:Clone()).Parent=b end if m[1].isModule then return m[1].Found,m[1].Folder,b elseif not I.Code then p("\087\105\110\100\111\119 \099\111\110\102\105\103 \109\105\115\115\105\110\103 \099\111\100\101\046\108\117\097\046 \065\114\101 \121\111\117\114 \066\097\115\101\095\084\104\101\109\101\115 \099\111\114\114\101\099\116\063 \099\108\105\101\110\116\046\085\073\046\071\101\116\078\101\119 \108\105\110\101 \050\051\054")end local i=m[1].Found:Clone()local D=i:FindFirstChild("\067\111\110\102\105\103")if D then D:Destroy()end b.Parent=i return i,m[1].Folder,b end end;Make=function(i,D,m)D=D or{}m=m or Qr.LastServerTheme or{Desktop="\068\101\102\097\117\108\116",Mobile="\077\111\098\105\108\105\117\115"}local I=Qr.CustomTheme or Rr.IsMobile()and m.Mobile or m.Desktop local e=Mr:FindFirstChild(I)or Mr.Default if not D.NoEnv and e:FindFirstChild("\078\111\069\110\118")then D.NoEnv=true D.modNoEnv=true end local b,C,t=Nr.GetNew(I,i)if b then local m=b:IsA("\077\111\100\117\108\101\083\099\114\105\112\116")local C=b:FindFirstChild("\067\111\110\102\105\103")local j=C and(C:FindFirstChild("\077\111\100\105\102\105\101\114")or C:FindFirstChild("\078\111\069\110\118-\077\111\100\105\102\105\101\114"))if j and not D.modNoEnv then D.modNoEnv=u.sub(j.Name,1,5)=="\078\111\069\110\118"end if m then return Nr.LoadModule(b,D,{script=b})elseif C and(t and t~=true)then local m=t:FindFirstChild("\067\111\100\101")or t:FindFirstChild("\078\111\069\110\118-\067\111\100\101")if not D.NoEnv and m then D.NoEnv=u.sub(m.Name,1,5)=="\078\111\069\110\118"end local M=t.AllowMultiple local x=M and M.Value or true local R,H=Nr.Get(i)if not R or(H and H>0)and x then local t,M=Nr.Register(b)if e:IsA("\077\111\100\117\108\101\083\099\114\105\112\116")then local i=u.sub(e.Name,1,5)=="\078\111\069\110\118"or e:FindFirstChild("\078\111\069\110\118")local I=dr({{script=e;gTable=t}})local C,j=S(v,e)local M={S(z(j,I),b,t,D,I)}local x,R=M[1],M[2]if R~=nil then if l(R)=="\117\115\101\114\100\097\116\097"and nr.GetClassName(R)=="\083\099\114\101\101\110\071\117\105"then m=R:FindFirstChild("\067\111\110\102\105\103")and(R.Config:FindFirstChild("\067\111\100\101")or R.Config:FindFirstChild("\078\111\069\110\118-\067\111\100\101"))or m if not D.NoEnv and m then D.NoEnv=u.sub(m.Name,1,5)=="\078\111\069\110\118"end else return R end end end b.Parent=Qr.GUIHolder b.Name=pr.GetRandom()D.gIndex=M D.gTable=t m.Parent=C m.Name=i if j then Nr.LoadModule(j,D,{script=j;gTable=t,Data=D,GUI=b;isModifier=true})end return Nr.LoadModule(m,D,{script=m;gTable=t;Data=D,GUI=b,Theme=I,ThemeFolder=e,isCode=true})end end else n("\071\085\073",i,"\110\111\116 \102\111\117\110\100")end end,Get=function(i,D,m)local I={}local e=0 if i then for b,C in Hr.GUIs do if C.Name~=D and(C.Object~=D and C~=D)then if l(i)=="\115\116\114\105\110\103"then if C.Name==i then I[b]=C e=e+1 if m then return C end end elseif l(i)=="\117\115\101\114\100\097\116\097"then if Rr.RawEqual(C.Object,i)then I[b]=C e=e+1 if m then return C end end elseif l(i)=="\098\111\111\108\101\097\110"and i==true then I[b]=C e=e+1 if m then return C end end end end end if e<1 then return false else return I,e end end;Remove=function(i,D)local m=Nr.Get(i,D)if m then for i,D in m do D.Destroy()end end end;Register=function(i,D)local m=pr.GetRandom()local I I={Object=i;Config=i:FindFirstChild("\067\111\110\102\105\103"),Name=i.Name,Events={};Class=i.ClassName;Index=m,Active=true;Ready=function()if I.Config then I.Config.Parent=nil end local i,D=S(function()local i=I.Object if I.Class=="\083\099\114\101\101\110\071\117\105"or I.Class=="\071\117\105\077\097\105\110"then if i.DisplayOrder==0 then i.DisplayOrder=90000 end i.Enabled=true i.Parent=Rr.PlayerGui else i.Parent=Nr.GetHolder()end end)if i then I.Active=true else p("\083\111\109\101\116\104\105\110\103 \104\097\112\112\101\110\101\100 \119\104\105\108\101 \116\114\121\105\110\103 \116\111 \115\101\116 \116\104\101 \112\097\114\101\110\116 \111\102",I.Name)p(D)I:Destroy()end end,BindEvent=function(i,D)local m=i:Connect(D)local e=m.Disconnect local b=I.Events local C=function()e(m)for i,D in b do if D.Signal==m then a.remove(b,i)end end end a.insert(b,{Signal=m;Remove=C})return{Disconnect=C;disconnect=C,wait=Rr.CheckProperty(m,"\119\097\105\116")and m.wait},m end,ClearEvents=function()for i,D in I.Events do D:Remove()end end,Destroy=function()S(function()if I.CustomDestroy then I.CustomDestroy()else(Rr.UnWrap(I.Object)):Destroy()end end)I.Destroyed=true I.Active=false Hr.GUIs[m]=nil I.ClearEvents()end;UnRegister=function()Hr.GUIs[m]=nil if I.AncestryEvent then I.AncestryEvent:Disconnect()end end,Register=function(i,D)if not D then D=i end D:SetSpecial("\068\101\115\116\114\111\121",I.Destroy)I.Object=Rr.Wrap(D)I.Class=D.ClassName if I.AncestryEvent then I.AncestryEvent:Disconnect()end I.AncestryEvent=D.AncestryChanged:Connect(function(i,D)if Hr.GUIs[m]and H(i,I.Object)then if I.Class=="\084\101\120\116\076\097\098\101\108"and D==Rr.PlayerGui then task.wait()I.Object.Parent=Nr.GetHolder()elseif H(i,I.Object)and(D==nil and not I.KeepAlive)then I:Destroy()elseif H(i,I.Object)and D~=nil then I.Active=true Hr.GUIs[m]=I end end end)Hr.GUIs[m]=I end}if D then for i,D in D do I[i]=D end end i.Name=pr.GetRandom()I:Register(i)return I,m end}Hr.UI.RegisterGui=Hr.UI.Register Hr.UI.GetGui=Hr.UI.Get Hr.UI.PrepareGui=Hr.UI.Prepare Hr.UI.MakeGui=Hr.UI.Make end

return function(Vargs, GetEnv)
	local env = GetEnv(nil, {script = script})
	setfenv(1, env)

	local _G, game, script, getfenv, setfenv, workspace,
	getmetatable, setmetatable, loadstring, coroutine,
	rawequal, typeof, print, math, warn, error,  pcall,
	xpcall, select, rawset, rawget, ipairs, pairs,
	next, Rect, Axes, os, time, Faces, unpack, string, Color3,
	newproxy, tostring, tonumber, Instance, TweenInfo, BrickColor,
	NumberRange, ColorSequence, NumberSequence, ColorSequenceKeypoint,
	NumberSequenceKeypoint, PhysicalProperties, Region3int16,
	Vector3int16, require, table, type, wait,
	Enum, UDim, UDim2, Vector2, Vector3, Region3, CFrame, Ray, delay =
		_G, game, script, getfenv, setfenv, workspace,
	getmetatable, setmetatable, loadstring, coroutine,
	rawequal, typeof, print, math, warn, error,  pcall,
	xpcall, select, rawset, rawget, ipairs, pairs,
	next, Rect, Axes, os, time, Faces, unpack, string, Color3,
	newproxy, tostring, tonumber, Instance, TweenInfo, BrickColor,
	NumberRange, ColorSequence, NumberSequence, ColorSequenceKeypoint,
	NumberSequenceKeypoint, PhysicalProperties, Region3int16,
	Vector3int16, require, table, type, wait,
	Enum, UDim, UDim2, Vector2, Vector3, Region3, CFrame, Ray, delay

	local UIFolder = client.UIFolder

	local script = script

	local service = Vargs.Service
	local client = Vargs.Client

	local GetEnv = env.GetEnv

	local Anti, Core, Functions, Process, Remote, UI, Variables, Deps
	local CloneTable, TrackTask
	local function Init()
		UI = client.UI;
		Anti = client.Anti;
		Core = client.Core;
		Variables = client.Variables
		Functions = client.Functions;
		Process = client.Process;
		Remote = client.Remote;
		Deps = client.Deps;

		CloneTable = service.CloneTable;
		TrackTask = service.TrackTask;

		UI.Init = nil;
	end

	local function RunLast()
		--[[client = service.ReadOnly(client, {
				[client.Variables] = true;
				[client.Handlers] = true;
				G_API = true;
				G_Access = true;
				G_Access_Key = true;
				G_Access_Perms = true;
				Allowed_API_Calls = true;
				HelpButtonImage = true;
				Finish_Loading = true;
				RemoteEvent = true;
				ScriptCache = true;
				Returns = true;
				PendingReturns = true;
				EncodeCache = true;
				DecodeCache = true;
				Received = true;
				Sent = true;
				Service = true;
				Holder = true;
				GUIs = true;
				LastUpdate = true;
				RateLimits = true;

				Init = true;
				RunLast = true;
				RunAfterInit = true;
				RunAfterLoaded = true;
				RunAfterPlugins = true;
			}, true)--]]
		UI.DefaultTheme = Remote.Get("Setting","DefaultTheme");
		UI.RunLast = nil;
	end

	getfenv().client = nil
	getfenv().service = nil
	getfenv().script = nil

	client.UI = {
		Init = Init;
		RunLast = RunLast;
		GetHolder = function()
			if UI.Holder and UI.Holder.Parent == service.PlayerGui then
				return UI.Holder
			else
				pcall(function()if UI.Holder then UI.Holder:Destroy()end end)
				local new = service.New("ScreenGui", {
					Name = Functions.GetRandom(),
					Parent = service.PlayerGui,
				});
				UI.Holder = new
				return UI.Holder
			end
		end;

		Prepare = function(gui)
			if true then return gui end	--// Disabled

			local gTable = UI.Get(gui,false,true)
			if gui:IsA("ScreenGui") or gui:IsA("GuiMain") then
				local new = Instance.new("TextLabel")
				new.BackgroundTransparency = 1
				new.Size = UDim2.new(1,0,1,0)
				new.Name = gui.Name
				new.Active = true
				new.Text = ""

				for ind,child in gui:GetChildren() do
					child.Parent = new
				end

				if gTable then
					gTable:Register(new)
				end

				gui:Destroy()

				return new
			else
				return gui
			end
		end;

		LoadModule = function(module, data, env)
			data = data or {}

			local ran, func = pcall(require, module)
			local newEnv = GetEnv(env, {
				script = module,
				client = CloneTable(client),
				service = CloneTable(service)
			})

			if newEnv.service.Threads then
				newEnv.service.Threads = CloneTable(service.Threads)
			end

			for i,v in newEnv.client do
				if type(v) == "table" and i ~= "Variables" and i ~= "Handlers" then
					newEnv.client[i] = CloneTable(v)
				end
			end

			if ran then
				--// Temporarily disabled NoEnv; it seems to be causing some issues(?)
				--// ~ Expertcoderz

				--[[if (data.isModifier and not data.modNoEnv) or (not data.isModifier and data.isCode and not data.NoEnv) then
					setfenv(func, env)
				end]]

				local rets = {
					TrackTask("UI: ".. module:GetFullName(),
						--func,
						setfenv(func, newEnv),
						data,
						newEnv
					)
				}

				if rets[1] then
					return unpack(rets, 2)
				else
					warn("Error while running module", module.Name, rets[2])
					client.LogError("Error loading ".. module.Name .." - ".. tostring(rets[2]))
				end
			else
				warn("Error while loading module", module.Name, tostring(func))
			end
		end;

		GetNew = function(theme, name)
			local foundConfigs = {}
			local endConfig = {}
			local endConfValues = {}

			local confFolder = Instance.new("Folder")
			local debounce = false

			local function func(theme, name, depth)
				local depth = (depth or 11) - 1

				local folder = UIFolder:FindFirstChild(theme) or UIFolder.Default
				if folder then
					local baseValue = folder:FindFirstChild("Base_Theme")
					local baseTheme = baseValue and baseValue.Value
					local foundGUI = folder:FindFirstChild(name) --local foundGUI = (baseValue and folder:FindFirstChild(name)) or UIFolder.Default:FindFirstChild(name)

					if foundGUI then
						local config = foundGUI:FindFirstChild("Config")
						table.insert(foundConfigs, {
							Theme = theme;
							Folder = folder;
							Name = name;
							Found = foundGUI;
							Config = config;
							isModule = foundGUI:IsA("ModuleScript");
						})

						if config then
							baseValue = config:FindFirstChild("BaseTheme") or baseValue
							baseTheme = baseValue and baseValue.Value
						end
					end
					if baseTheme and depth > 0 then
						if UI.DefaultTheme and baseTheme == "Default" and theme ~= UI.DefaultTheme and not debounce then
							func(UI.DefaultTheme, name, depth)
						else
							debounce = true
							func(baseTheme, name, depth)
						end
					end
				end
			end

			--// Find GUI and all default versions under it
			func(theme, name)
			confFolder.Name = "Config"

			--// Create the final config for the found GUI.

			if #foundConfigs > 0 then
				--// Combine all configs found in order  to build full config (in order of closest from target gui to furthest)
				for i,v in foundConfigs do
					if v.Config then
						for k,m in v.Config:GetChildren() do
							if not endConfig[m.Name] then
								if string.sub(m.Name, 1, 5) == "NoEnv" then
									endConfig["Code"] = m
								end

								endConfig[m.Name] = m
							end
						end
					end
				end

				--// Load all config values into the new Config folder
				for i,v in endConfig do
					v:Clone().Parent = confFolder;
				end

				--// Find next module based theme GUI if code not found or first in sequence is module (in theme)
				if foundConfigs[1].isModule then
					return foundConfigs[1].Found, foundConfigs[1].Folder, confFolder
				elseif not endConfig.Code then
					warn("Window config missing code.lua. Are your Base_Themes correct? client.UI.GetNew line 236")
				end

				--// Get rid of an old Config folder and throw the new combination Config folder in
				local new = foundConfigs[1].Found:Clone()
				local oldFolder = new:FindFirstChild'Config'

				if oldFolder then oldFolder:Destroy() end

				confFolder.Parent = new
				return new, foundConfigs[1].Folder, confFolder
			end
		end;

		Make = function(name, data, themeData)
			data = data or {}
			themeData = themeData or Variables.LastServerTheme or {Desktop = "Default"; Mobile = "Mobilius"}

			local theme = Variables.CustomTheme or (service.IsMobile() and themeData.Mobile) or themeData.Desktop
			local folder = UIFolder:FindFirstChild(theme) or UIFolder.Default

			--// Check for any childs with 'NoEnv' and trigger NoEnv
			--// Enforce NoEnv to ensure theme is using it.
			if not data.NoEnv and folder:FindFirstChild("NoEnv") then
				data.NoEnv = true
				data.modNoEnv = true
			end

			--// folder2
			local newGui, _, foundConf = UI.GetNew(theme, name)

			if newGui then
				local isModule = newGui:IsA("ModuleScript")
				local conf = newGui:FindFirstChild("Config")
				local mod = conf and (conf:FindFirstChild("Modifier") or conf:FindFirstChild("NoEnv-Modifier"))

				if mod and not data.modNoEnv then
					data.modNoEnv = string.sub(mod.Name, 1, 5) == "NoEnv"
				end

				if isModule then
					return UI.LoadModule(newGui, data, {
						script = newGui;
					})
				elseif conf and foundConf and foundConf ~= true then
					local code = foundConf:FindFirstChild("Code") or foundConf:FindFirstChild("NoEnv-Code")

					if not data.NoEnv and code then
						data.NoEnv = string.sub(code.Name, 1, 5) == "NoEnv"
					end

					local mult = foundConf.AllowMultiple
					--local keep = foundConf.CanKeepAlive

					local allowMult = mult and mult.Value or true
					local found, num = UI.Get(name)

					if not found or ((num and num>0) and allowMult) then
						local gTable,gIndex = UI.Register(newGui)

						if folder:IsA("ModuleScript") then
							local folderNoEnv = string.sub(folder.Name, 1, 5) == "NoEnv" or folder:FindFirstChild("NoEnv")

							local newEnv = GetEnv{{
								script = folder,
								gTable = gTable
							}}

							local ran, func = pcall(require, folder)
							local rets = {
								--// NoEnv temporarily disabled ~ Expertcoderz
								--[[if folderNoEnv then pcall(func, newGui, gTable, data, newEnv) else]] pcall(setfenv(func, newEnv), newGui, gTable, data, newEnv)
							}

							local ran, ret = rets[1], rets[2]
							if ret ~= nil then
								if type(ret) == "userdata" and Anti.GetClassName(ret) == "ScreenGui" then
									code = (ret:FindFirstChild("Config") and (ret.Config:FindFirstChild("Code") or ret.Config:FindFirstChild("NoEnv-Code"))) or code

									if not data.NoEnv and code then
										data.NoEnv = string.sub(code.Name, 1, 5) == "NoEnv"
									end
								else
									return ret
								end
							end
						end

						newGui.Parent = Variables.GUIHolder
						newGui.Name = Functions.GetRandom()

						data.gIndex = gIndex
						data.gTable = gTable

						code.Parent = conf
						code.Name = name

						if mod then
							UI.LoadModule(mod, data, {
								script = mod;
								gTable = gTable;
								Data = data;
								GUI = newGui;
								isModifier = true;
							})
						end

						return UI.LoadModule(code, data, {
							script = code;
							gTable = gTable;
							Data = data;
							GUI = newGui;
							Theme = theme;
							ThemeFolder = folder;
							isCode = true;
						})
					end
				end
			else
				print("GUI", name, "not found")
			end
		end;

		Get = function(obj,ignore,returnOne)
			local found = {}
			local num = 0
			if obj then
				for ind,g in client.GUIs do
					if g.Name ~= ignore and g.Object ~= ignore and g ~= ignore then
						if type(obj) == "string" then
							if g.Name == obj then
								found[ind] = g
								num = num+1
								if returnOne then return g end
							end
						elseif type(obj) == "userdata" then
							if service.RawEqual(g.Object, obj) then
								found[ind] = g
								num = num+1
								if returnOne then return g end
							end
						elseif type(obj) == "boolean" and obj == true then
							found[ind] = g
							num = num+1
							if returnOne then return g end
						end
					end
				end
			end
			if num<1 then
				return false
			else
				return found,num
			end
		end;

		Remove = function(name, ignore)
			local gui = UI.Get(name, ignore)
			if gui then
				for i,v in gui do
					v.Destroy()
				end
			end
		end;

		Register = function(gui, data)
			local gIndex = Functions.GetRandom()
			local gTable;gTable = {
				Object = gui,
				Config = gui:FindFirstChild'Config';
				Name = gui.Name,
				Events = {},
				Class = gui.ClassName,
				Index = gIndex,
				Active = true,
				Ready = function()
					if gTable.Config then gTable.Config.Parent = nil end
					local ran,err = pcall(function()
						local obj = gTable.Object;
						if gTable.Class == "ScreenGui" or gTable.Class == "GuiMain" then
							if obj.DisplayOrder == 0 then
								obj.DisplayOrder = 90000
							end

							obj.Enabled = true
							obj.Parent = service.PlayerGui
						else
							obj.Parent = UI.GetHolder()
						end
					end);

					if ran then
						gTable.Active = true
					else
						warn("Something happened while trying to set the parent of", gTable.Name)
						warn(err)

						gTable:Destroy()
					end
				end,

				BindEvent = function(event, func)
					local signal = event:Connect(func)
					local origDisc = signal.Disconnect
					local Events = gTable.Events
					local disc = function()
						origDisc(signal)
						for i,v in Events do
							if v.Signal == signal then
								table.remove(Events, i)
							end
						end
					end

					table.insert(Events, {
						Signal = signal;
						Remove = disc
					})

					return {
						Disconnect = disc;
						disconnect = disc;
						wait = service.CheckProperty(signal, "wait") and signal.wait
					}, signal
				end,

				ClearEvents = function()
					for i,v in gTable.Events do
						v:Remove()
					end
				end,

				Destroy = function()
					pcall(function()
						if gTable.CustomDestroy then
							gTable.CustomDestroy()
						else
							service.UnWrap(gTable.Object):Destroy()
						end
					end)
					gTable.Destroyed = true
					gTable.Active = false
					client.GUIs[gIndex] = nil
					gTable.ClearEvents()
				end,

				UnRegister = function()
					client.GUIs[gIndex] = nil
					if gTable.AncestryEvent then
						gTable.AncestryEvent:Disconnect()
					end
				end,

				Register = function(tab,new)
					if not new then new = tab end

					new:SetSpecial("Destroy", gTable.Destroy)
					gTable.Object = service.Wrap(new)
					gTable.Class = new.ClassName

					if gTable.AncestryEvent then
						gTable.AncestryEvent:Disconnect()
					end

					gTable.AncestryEvent = new.AncestryChanged:Connect(function(c, parent)
						if client.GUIs[gIndex] and rawequal(c, gTable.Object) then
							if gTable.Class == "TextLabel" and parent == service.PlayerGui then
								task.wait()
								gTable.Object.Parent = UI.GetHolder()
							elseif rawequal(c, gTable.Object) and parent == nil and not gTable.KeepAlive then
								gTable:Destroy()
							elseif rawequal(c, gTable.Object) and parent ~= nil then
								gTable.Active = true
								client.GUIs[gIndex] = gTable
							end
						end
					end)
					client.GUIs[gIndex] = gTable
				end
			}

			if data then
				for i,v in data do
					gTable[i] = v
				end
			end

			gui.Name = Functions.GetRandom()
			gTable:Register(gui)

			return gTable,gIndex
		end
	}

	client.UI.RegisterGui = client.UI.Register
	client.UI.GetGui = client.UI.Get
	client.UI.PrepareGui = client.UI.Prepare
	client.UI.MakeGui = client.UI.Make
end
