addObject=function(a,f,B)if script then local f=pcall(check,a)if not f then return end end local l if B then l=NodeLookup[B]else l=NodeLookup[a.Parent]end if not l then return end local e={Object=a;Parent=l;Index=0,Expanded=false;Selected=false,Depth=depth(a)}connLookup[a]=Connect(a.AncestryChanged,function(f,B)if f==a then if B==nil then removeObject(f)else moveObject(f,B)end end end)NodeLookup[a]=e insert(l,#l+1,e)if not f then if nodeIsVisible(e)then updateList()elseif nodeIsVisible(e.Parent)then updateScroll()end end end local function a(a,f)RemoteEvent:InvokeServer("\073\110\115\116\097\110\099\101\078\101\119",a.ClassName,a.Properties)end local function f(a)local f={ClassName=a.ClassName;Properties={}}for B,l in pairs(RbxApi.GetProperties(a.className))do if l.Name~="\080\097\114\101\110\116"then print("\116\104\105\115\112\097\115\115\101\100")table.insert(f.Properties,{Name=l.Name;Type=l.ValueType;Value=tostring(a[l.Name])})end end return f end do local function a(a)NodeLookup[a]={Object=a,Parent=nil,Index=0;Expanded=true}end a(game)NodeLookup[DexOutput]={Object=DexOutput;Parent=nil;Index=0,Expanded=true}a(HiddenEntries)a(HiddenGame)Connect(game.DescendantAdded,addObject)Connect(game.DescendantRemoving,removeObject)Connect(DexOutput.DescendantAdded,addObject)Connect(DexOutput.DescendantRemoving,removeObject)local function f(a)return a:GetChildren()end local function B(a)if a==game and MuteHiddenItems then for a,f in pairs(gameChildren)do addObject(f,true)B(f)end return end local l,e=pcall(f,a)if l then for a=1,#e,1 do addObject(e[a],true)B(e[a])end end end B(game)B(DexOutput)B(HiddenEntries)scrollBar.VisibleSpace=math.ceil(listFrame.AbsoluteSize.y/ENTRY_BOUND)updateList()end

addObject = function(object,noupdate,parent)
	if script then
		-- protect against naughty RobloxLocked objects
		local s = pcall(check,object)
		if not s then
			return
		end
	end

	local parentNode

	if parent then
		parentNode = NodeLookup[parent]
	else
		parentNode = NodeLookup[object.Parent]
	end

	if not parentNode then
		return
	end

	local objectNode = {
		Object = object;
		Parent = parentNode;
		Index = 0;
		Expanded = false;
		Selected = false;
		Depth = depth(object);
	}

	connLookup[object] = Connect(object.AncestryChanged,function(c,p)
		if c == object then
			if p == nil then
				removeObject(c)
			else
				moveObject(c,p)
			end
		end
	end)

	NodeLookup[object] = objectNode
	insert(parentNode,#parentNode+1,objectNode)

	if not noupdate then
		if nodeIsVisible(objectNode) then
			updateList()
		elseif nodeIsVisible(objectNode.Parent) then
			updateScroll()
		end
	end
end

local function makeObject(obj, par)
	--[[local newObject = Instance_new(obj.ClassName)
	for i,v in pairs(obj.Properties) do
		ypcall(function()
			local newProp
			newProp = ToPropValue(v.Value,v.Type)
			newObject[v.Name] = newProp
		end)
	end
	newObject.Parent = par

	obj.Properties.Parent = par--]]

	RemoteEvent:InvokeServer("InstanceNew", obj.ClassName, obj.Properties)
end

local function writeObject(obj)
	local newObject = {ClassName = obj.ClassName, Properties = {}}
	for i,v in pairs(RbxApi.GetProperties(obj.className)) do
		if v["Name"] ~= "Parent" then
			print("thispassed")
			table.insert(newObject.Properties,{Name = v["Name"], Type = v["ValueType"], Value = tostring(obj[v["Name"]])})
		end
	end
	return newObject
end

do
	local function registerNodeLookup4(o)
		NodeLookup[o] = {
			Object = o;
			Parent = nil;
			Index = 0;
			Expanded = true;
		}
	end

	registerNodeLookup4(game)

	NodeLookup[DexOutput] = {
		Object = DexOutput;
		Parent = nil;
		Index = 0;
		Expanded = true;
	}

	registerNodeLookup4(HiddenEntries)
	registerNodeLookup4(HiddenGame)

	Connect(game.DescendantAdded,addObject)
	Connect(game.DescendantRemoving,removeObject)

	Connect(DexOutput.DescendantAdded,addObject)
	Connect(DexOutput.DescendantRemoving,removeObject)

	local function get(o)
		return o:GetChildren()
	end

	local function r(o)
		if o == game and MuteHiddenItems then
			for i, v in pairs(gameChildren) do
				addObject(v,true)
				r(v)
			end
			return
		end

		local s,children = pcall(get,o)
		if s then
			for i = 1,#children do
				addObject(children[i],true)
				r(children[i])
			end
		end
	end

	r(game)
	r(DexOutput)

	r(HiddenEntries)

	scrollBar.VisibleSpace = math.ceil(listFrame.AbsoluteSize.y/ENTRY_BOUND)
	updateList()
end
