Identify a part in every parent

I didn’t found a better name, but i want to make a script where can search every part or model in the game, or find a value in there. How i do that?

You could use:

workspace:GetDescendants()

Read more about it here:

1 Like

This is the basic template for getting all parts in Workspace:

local descendants = game.Workspace:GetDescendants()

for index, descendant in pairs(descendants) do
    if descendant:IsA("BasePart") then
        --Code
    end
end
1 Like

Still a little confussed on what you are asking for. But there are now functions available to find more specific things around the given instance.

FindFirstAncestor
FindFirstAncestorOfClass
FindFirstAncestorWhichIsA
FindFirstChildOfClass
FindFirstChildWhichIsA

And also
IsAncestorOf
IsDescendantOf