So I've made a function that should essentially weld all of the objects within a model to the model's PrimaryPart,
The code is as this:
function QWeld(Model)
local ModKids = Model:GetChildren()
for i = 1,#ModKids do
if Model.PrimaryPart~= ModKids[i] then
local W = Instance.new("Motor6D",Model.PrimaryPart)
W.Part0 = W.Parent
W.Part1 = ModKids[i]
W.C0 = Model.PrimaryPart.CFrame:toObjectSpace(ModKids[i].CFrame)
if Model.Name == Gun then
table.insert(GunWelds,W)
end
ModKids[i].Anchored = false
end
end
end
This is all good'n gravy, however the C0's always come out as (0, 0, 0, 1, 0,0,0,0), or to that effect. It essentially is just welded together at CFrame.new(0,0,0). Is there anything I can do to fix this? I've tried anchoring the whole model, just the PrimaryPart, but I can't seem to fix this. |