Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.