Scripting / Method
GetDescendants()
Returns every instance nested beneath an Instance or Workspace.
Syntax
instance:GetDescendants()Example: Find Every BasePart In A Model
Luau
local model = workspace:FindFirstChild("Building")
if model then
for _, object in ipairs(model:GetDescendants()) do
if object:IsA("BasePart") then
object.Anchored = true
end
end
endThe returned table contains descendants only; it does not include the object on which you called the method.