getnilinstances
Returns all Instances whose Parent is nil.
function getnilinstances(): {Instance}Synopsis
How it works
A filtered version of
getinstances() that only returns InstancesInstanceThe base class for all Roblox objects (Parts, Models, Scripts, GUIs, etc.). Instances form a tree hierarchy (the DataModel). In Luau, they appear as userdata with shared metatables. whose Parent is nil. These are "orphaned" objects that exist in memory but aren't attached to the DataModelDataModelThe root Instance in Roblox's object hierarchy (game). Contains all services (Workspace, Players, ReplicatedStorage, etc.). Teleporting destroys the current DataModel and creates a new one. hierarchy. Games often create RemoteEvents, BindableEvents, and data tables parented to nil to hide them from normal traversal.Discovery pattern
Common pattern for finding hidden RemoteEvents:
for _, inst in ipairs(getnilinstances()) do
if inst:IsA("RemoteEvent") then
print(inst.Name)
end
endUsage
Find nil-parented RemoteFunctions
for _, inst in ipairs(getnilinstances()) do
if inst:IsA("RemoteFunction") then
print(inst.Name)
end
endReturns
{Instance} Array of Instances with nil parent.