您如何在 Roblox 中使用脚本锚定大量群组?

How do you anchor tons of groups with a script in Roblox?

我已经为在许多松树中生成的新地图工作了很长时间。在我完成所有工作后,我注意到松树中的对象没有被锚定,我在里面制作了一组名为“PineTrees”的所有松树我放了一个普通脚本来尝试锚定组中的所有对象。它最终抛出错误“GetDescendant 不是 Model 的有效成员”。这是脚本:

local model = script.Parent
local childs = model:GetDescendant() 
for I,v in pairs(childs) do 
    if v:IsA("BasePart") then 
        v.Anchored = true
    end
end

您只是拼错了 function's name

local childs = model:GetDescendants()