0

As I've said above, I'd like to ask if you could get an instance out of others with the same name by the attributes given to it.

1 Answers1

1

If you already have the set of objects and you need to find one specifically, you could iterate over all of the objects and check if one has the attribute you're looking for :

-- find all the Instances in a Folder
local instances = game.workspace.PartsNamedFoo:GetChildren()

-- find the specific instance based on a specific attribute
local foundInstance = nil
for _, instance in ipairs(instances) do
     if instance:GetAttribute("SOMETHING") == "TheOneYouAreLookingFor" then
         foundInstance = instance
         break
     end
end

-- do a thing now that we have it
if foundInstance then
    print("Found an instance with the right attribute :", foundInstance)
else
    warn("Could not find an instance with the matching attribute")
end

But if you don't already have that set of objects, there does not appear to be a way to locate an object based on its attributes.

For reference :

Kylaaa
  • 6,349
  • 2
  • 16
  • 27