Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function weldModel(model, basePart)
- local function weldBetween(a, b)
- --Make a new Weld and Parent it to a.
- local weld = Instance.new("ManualWeld", a)
- --Get the CFrame of b relative to a.
- weld.C0 = a.CFrame:inverse() * b.CFrame
- --Set the Part0 and Part1 properties respectively
- weld.Part0 = a
- weld.Part1 = b
- --Return the reference to the weld so that you can change it later.
- return weld
- end
- for _,v in pairs(model:GetChildren()) do
- if v:IsA("BasePart") and v ~= basePart then
- weldBetween(basePart, v)
- elseif v:IsA("Model") then
- weldModel(v, basePart)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement