getnilinstances Synchronous

Find known Instances with no Parent. This is useful for checking objects your script has created but not yet placed in the DataModel.

Syntax
Luau
getnilinstances() -> {Instance}

Parameters

This function takes no arguments.

Returns

{Instance}

An array of nil-parented Instances currently visible to the runtime.

Usage notes

Only known cached objects are considered; a nil parent by itself does not guarantee an object will appear.

Example

Example
Luau
local folder = Instance.new("Folder")
local unparented = getnilinstances()
print("Known nil-parented objects:", #unparented)
folder:Destroy()
Kawaii documentation