Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What does this Weld Script accomplish that is in a grouped model.?

Asked by 6 years ago

I'm kinda new to scripting and was wondering what parts are being affected in this script.

function recurse(parent, funcToUse)

for _, v in pairs(parent:GetChildren()) do

funcToUse(v)
recurse(v, funcToUse)

end

end

local firstPart = script.Parent:GetChildren()[1];

recurse(script.Parent, function(object)
if object:IsA("BasePart") and object~=firstPart then

weld = Instance.new("Weld", object)
weld.C0 = firstPart.CFrame:toObjectSpace(object.CFrame)
weld.C1 = CFrame.new()
weld.Part0 = firstPart
weld.Part1 = object

end
end)

The Script is in a model with parts and other models inside 1 model.

Could someone please tell me what parts are being welded or affected by the script? I don't understand and can't see to find out.

1 answer

Log in to vote
0
Answered by 6 years ago

The parts that will be affected by this would be anything above the script on the explorer. Only by one. Its the PARENT of the script so its going to go one up above it on the explorer.

Ad

Answer this question