如何用脚本在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
点赞
用户2860267
用户2860267

你只是拼错了 函数名

local childs = model:GetDescendants()
2020-06-21 07:14:08