Filter Selectable Instances Inside Plugins

As a Roblox developer, it is currently too hard to filter the instances that can be selected in a easy/non-destrutive manner.

If this issue is addressed, it would improve my development experience because I would be able to create plugins that would allow me to efficiently select/move/edit specific features in my game (zones, monster spawners, invisible barriers, etc).

What I want to use this for?

I want to use this for plugins that serve as editors for certain features in my game. For example, a zone editor. I want to easily select the zones in my game to move/rotate/scale them easily.

What works now and why it’s not ideal?

  1. One way to achieve this behavior is by setting Locked = false. However, even though you can’t select a part with Locked = false, it will stop you selecting other parts that are blocked by it (except with drag select). It also doesn’t work with instances like Attachment.
  2. Using collision groups and filtering game:GetService("Selection"):Get() by manually setting it via game:GetService("Selection"):Set(). Doing it this way is difficult because there are minor nuances. Here’s an example implementation I made.

Both of these methods are destructive. You need to undo these changes when you are ready to save/publish your place. Otherwise, Locked would be incorrect or you will have incorrect collision groups. (This is a mistake I’ve unforunately made).

Expected Behavior

I should be able to select whitelisted instance through filtered parts. I should be able to select whitelisted instances even if Locked = true. The whitelist should apply to instances selected via the select/move/rotate/scale tools or the explorer.

API Suggestions

My SelectionFilter module whitelists instances based on CollectionService tags but the API could take a list of parts so it covers more use cases.

2 Likes