getnilinstances
Returns cached instances with no parent.
Syntax
getnilinstances() -> tableReturns
| Type | Description |
|---|---|
table | Array of cached, nil-parented instances |
Description
getnilinstances returns cached instances whose Parent is nil.
Example
local nilInstances = getnilinstances()
print("Nil instances:", #nilInstances)
for _, inst in ipairs(nilInstances) do
print(inst.ClassName, inst.Name)
endFinding Hidden Scripts
-- Scripts are sometimes hidden by setting parent to nil
local hiddenScripts = {}
for _, inst in ipairs(getnilinstances()) do
if inst:IsA("LocalScript") or inst:IsA("ModuleScript") then
table.insert(hiddenScripts, inst)
end
end
print("Found", #hiddenScripts, "hidden scripts")Use Cases
- Finding cached hidden instances: Locate instances that are no longer parented
- Script discovery: Find scripts that were parented to nil
- Cache inspection: See which cached instances currently have no parent
Related Functions
getinstances- Get cached instances