Scripts

getreferencedby

Returns cached Instance values whose supported reference properties point to the provided Instance.

Syntax

getreferencedby(instance: userdata): table
Aliases getreferences

Arguments

NameTypeDescription
instanceuserdataTarget Instance to search references for.

Returns

NameTypeDescription
instancestableNew array table of matching registered Instance object values.

Description

Returns cached Instance values whose supported reference properties point to the provided Instance. The argument must be an Instance.

Call it with 1 parameter(s): instance. The argument table explains which values are required and which ones only refine the behavior.

It returns instances (table). Use the returns table to separate successful values from nil results and recoverable errors.

Example

Find values that reference a specific Instance.

local references = getreferencedby(workspace)

for _, value in ipairs(references) do
    print(value)
end