As of the last release, Release 377, tostring
can no longer be used to get the name of Instances that are restricted. As people were using this to identify Instances, this thread gains relevance.
Within a normal studio environment, there are currently four locked services that even the command bar cannot index. At times, Instances that are locked have been placed in locations that would normally be accessible. As someone who writes plugins that interacts with Selection, this has caused problems in the past.
A setting was recently added to Studio to display the entire game hierarchy in the Explorer widget. This exposes CSGDictionaryService, NonReplicatedCSGDictionaryService, CorePackages, and RobloxReplicatedStorage to be selected without using Selection. This makes the problem with selecting restricted Instances worse because it can happen during normal Studio use.
To prevent this error from happening, you currently have to identify what is selected without indexing it, or catch any errors that occur when trying to index it. The former is no easy task, and the second one can unnecessarily complicate code. A lot of plugins that use Selection simply don’t do this validating because they don’t think about it which creates messy errors in the output. This has and will likely continue to cause confusion in the future because the meaning behind these errors is currently not documented anywhere officially.
If we were guaranteed access to basic properties, methods, and events of all Instances, this problem would be solved for the most part since the most common cause of these errors is trying to index basic hierarchical or labeling information, like Parent, ClassName, or Name. Writing to these properties should still be forbidden for obvious reasons.
An added bonus to this would be that Instances would no longer be able to hide behind RobloxLocked Instances. Currently, you can parent to restricted Instances either just through directly setting something’s Parent or by exploiting. That Instance is then protected from all scrutiny by proxy, preventing you from identifying if it was added by Roblox or by a potentially malicious third party. Some developers use client-side checks to see if anything suspicious was added from the client, and this sort of accessibility would be invaluable to them. If the hierarchy was guaranteed to be traversable, it would be possible, and without compromising the actual security of RobloxLocked Instances.