I do not know if this request has been made before, as I did not find anything similar.
Instance:GetLinked() :: {Instance?} would be a pretty neat addition. It would work similar to GetChildren(), however it will return only Instances that are connected to them by Instance setting properties, like the only purpose of an ObjectValue.
For example:
- say I want to call
workspace.CurrentCamera:GetLinked(), the function will return all the ViewportFrames connected to it, if any, through theViewportFrame.CurrentCameraproperty, - same for
ObjectValues above, - or get all the instances that are the
Adorneeof something.
I hope more people would find a need for this, because I certainly would’ve loved this right now.
Sure, you can do it with a module and a lookup table, but that would require to loop through game:GetDescendants(), which becomes unnecessary.
It’s worth mentioning that a GetLinkedAttributed() would also be great due to the recent addition of InstanceHandle.