CollectionService:GetTagged with ancestor

As a Roblox developer, it is currently too hard to get all of the tagged instances that are descendants of an object. Adding a second argument, ancestor, to CollectionService:GetTagged would make this process easier. What it would do is return only instances that are descendants of the ancestor object.

Example:

CollectionService:GetTagged("Tree", workspace.Decoration) 
    --> returns all descendants of workspace.Decoration with the tag "Tree"

CollectionService:GetTagged("Tree")
    --> returns all instances with the tag "Tree"

My reason for this is that if there are thousands or even tens of thousands of instances with a tag, calling Instance:IsDescendantOf(ancestor) on every instance in the returned table could be costly, as well as adding a few more lines to my code each time I have to do this.

If Roblox is able to address this issue, it would improve my development experience because I could get all tagged instances that are descendants of an object easier and faster.

Alternative solution:
Add this feature request instead, and add a function, Instance:GetTagged(tag), which could act just like CollectionService:GetTagged except that it only returns descendants of itself.

11 Likes