Filter by Attributes in Explorer

As a Roblox developer, it is currently too hard to find all instances in a game that have a specific attribute, or find all instances that have a specific attribute value.

It would be great if I could filter the explorer to:

  • show all instances with a certain attribute name
  • show all instances with a certain attribute value

My most common use for attributes is having the name of a config table stored as a string (i.e. object:GetAttribute("ObjectType") == "StrongFence"). I occasionally find myself wanting to browse all instances with the ObjectType attribute to see which types are in use, or find all instances with a specific ObjectType value for the purpose of renaming the type or making sure that all of the uses are correct. At the moment, the most efficient way to do this is through writing custom code into the command line.

If Roblox is able to address this issue, it would improve my development experience because I’d be able to manage my game’s attributes more efficiently.

17 Likes

Hi, this is absolutely desired though I want to outline some of the complexity as to why we shipped without this. Essentially, it is trivial today for us to do existing property searches with Property = Value, as we can statically know every property that you could possibly be searching for, and ignore everything without that property.

However attributes remove this valuable optimization property, pun intended. I was going to put it on a separate syntax like a:AttributeName = value (longform attribute:AttributeName = value) but got a bit squeamish. I think I’ll end up doing that someday though.

12 Likes

Does someday mean… a year? two? Really needed functionality for my project right now.
Our games map has hundreds of thousands of roblox objects all placed strategically all over the place. Using this filter will help me check certain objects without having to check every object.

Does someday mean… a year? two?

No ETA, but not soon.

1 Like

In the meantime it’s technically possible to make a plugin yourself that does all of this. It would take a substantial amount of work, but if this is a big blocker for your project, it might be worth the effort.

1 Like

a bit biased, but this is why i still prefer to use object based values over using attributes, it makes things less hidden and easier to notice and search

1 Like

Dude, its really annoying that I can’t search attributes because I store stuff sometimes under attributes and i legit cant search it to change it quickly :expressionless:

Needed this just now to remove a bunch of attributes that are no longer used. I’m migrating to an attribute with an opposite meaning so I need to know which parts the old attribute used to be on. Had to use command bar.

2 Likes

Is there any update to this? If so, when can we expect this feature to be implemented? I went looking for how to do this just now and found out I can’t. There is a tag: option in the dropdown list, so I wonder if something like this would work but in Studio native code:

local function searchAttributes(name: string, searchValue: string?)
	local list = game.Workspace:GetDescendants()
	local attribValue
	for _, item in ipairs(list) do
		attribValue = item:GetAttribute(name)
		if attribValue ~= nil then
			if searchValue ~= nil and attribValue == searchValue then
				print(Instance:GetFullName(), "=", seachValue)
			else
				print(item:GetFullName())
			end
		end
	end
end

As for making this into a plugin, I don’t really write plugins. I’ll leave that to someone who does. As a workaround, you can copy/paste the above function onto the command line (minus the local tag on the function) and just run it.

Here is a command bar snippet to select all:

  • Instances that have an Attribute, regardless of its value. OR
  • Instances where the Attribute has a specific value.
local ATTR_NAME = "Devproduct"; local ATTR_VALUE = nil; --[[<--Config]] game.Selection:Set({});for _,p in game:GetDescendants()do if p:GetAttribute(ATTR_NAME)and(ATTR_VALUE==nil or p:GetAttribute(ATTR_NAME)==ATTR_VALUE)then game.Selection:Add({p})end end

How to use it:

  • Set ATTR_NAME to the name of the attribute you want to search for.
  • Set ATTR_VALUE to filter by a specific value of that attribute.
  • If ATTR_VALUE is set to nil, it will select all instances that have ATTR_NAME, regardless of its value.

Explanation of the code:

local ATTR_NAME = "Devproduct"  -- Name of the attribute to search for
local ATTR_VALUE = "525 Coins"  -- (Optional) Value to match, set to nil to select all with ATTR_NAME

-- Clear the current selection
game.Selection:Set({})

-- Iterate through all descendants of the game
for _, p in game:GetDescendants() do
    -- Check if the object has the specified attribute
    if p:GetAttribute(ATTR_NAME) then
        -- If ATTR_VALUE is nil, select all instances with the attribute
        -- Otherwise, only select objects where the attribute matches the value
        if ATTR_VALUE == nil or p:GetAttribute(ATTR_NAME) == ATTR_VALUE then
            game.Selection:Add({p}) -- Add the matching object to the selection
        end
    end
end

Hope this helps!