I’ve been making a portion of code inside my weld script where if I unequip my tool it would then clone all the parts, parent them to a model and then welding them together. I’ve gotten to the point where the parts are where I want it to be, but all the parts are just in a mess.
This is what I want it to look like:
This is what I have achieved so far:
I’ve looked through dev forum for a bit and I’ve also read the API reference on CFrame but I still don’t really understand. (I’ve always used WeldContraints in stuff like these so I don’t go insane making a weld script.)
This is what the portion of code that I’m working on looks like as of right now:
script.Parent.Unequipped:Connect(function()
local Torso = script.Parent.Parent.Parent.Character.Torso
Model = Instance.new("Model", Torso)
for _, v in pairs(script.Parent:GetChildren()) do
if v:IsA("UnionOperation") or v:IsA("Part") or v:IsA("BasePart") or v:IsA("MeshPart") then
local Cloned = v:Clone()
Cloned.Parent = Model
local Weld = Instance.new("Weld", Torso)
Weld.Part0 = Torso
Weld.Part1 = Cloned
Weld.C1 = Cloned.CFrame:ToObjectSpace(Cloned.CFrame * CFrame.new(0, 0, 1))
end
end
end)
Any sort of help would be greatly appreciated since I will most likely be working on more things that involve welds and a solution to this would probably make me understand a bit more about CFrame and welds.