So basically I am trying to convert a model into a tool, which should be pretty simple.
This is my code:
--I have a variable for the model and player already.
local tool = Instance.new('Tool')
for _, child in pairs(model:GetChildren()) do
print('Cloning '.. child.Name)
child:Clone().Parent = tool
end
tool.Parent = plr.Backpack
It converts the model to a tool just fine, but when I try equipping the tool, the parts aren’t welded to eachother. I can only see 1/2 parts in the tool, the second part isn’t visible (i am guessing it fell into the void)
Due to you cloning each part individually and sequentially, the welds inside the cloned parts would have no reference to the non-cloned parts yet.
So what I would do is clone the model then parent the parts inside the cloned model to the tool.
local tool = Instance.new('Tool')
local modelClone = model:Clone()
for _, child in pairs(modelClone:GetChildren()) do
child.Parent = tool
end
tool.Parent = plr.Backpack
modelClone:Destroy() -- Prevents memory leaks.