I made a module function for getting all descendants of an object. It looks like this:
function module.GetDescendants(object) if type(object) ~= "userdata" then assert(false, "Argument must be a userdata value.") return end local descendants = {} for _, child in pairs(object:GetChildren()) do table.insert(descendants, child) if child:GetChildren{}[1] then for _, child2 in pairs(module.GetDescendants(child)) do table.insert(descendants, child2) end end end return descendants end
Then I tried it out with this script for listing the descendants of the workspace:
GetDescendants = require(game.ServerScriptService.GetDescendants).GetDescendants --The function, not the module directory = workspace brk = string.char(13) for i, v in pairs(GetDescendants(directory)) do print("Element "..i..brk.."Name: "..v.Name..brk.."Class: "..v.ClassName..brk.."Address: "..v:GetFullName()..brk) end
In the output, this is the last element in the descendant table. It's a message object called Message, and it's located directly in workspace.
--[[Element 134 Name: Message Class: Message Address: Workspace.Message]]--
I can't see this message in the hierarchy. I can't destroy it, I can't print out the text, etc. What is this message?