This is an annoying issue I have been trying to solve for a while, with no luck.
I am creating a custom inventory sytem, and it requires me to clone objects/tools to display them in a Viewport.
local item = game.ReplicatedStorage.PlayerInventories:FindFirstChild(Player.Name).Tools:FindFirstChild(tool.Name, true):Clone()
item.Parent = toolButton.ViewportFrame
local itemCamera = Instance.new("Camera")
itemCamera.Parent = toolButton.ViewportFrame
itemCamera.CFrame = item.PrimaryPart.CFrame + Vector3.new(-0.027, -0.05, 3.155)
itemCamera.CFrame = CFrame.lookAt(itemCamera.CFrame.Position, item.PrimaryPart.Position)
itemCamera.CFrame = itemCamera.CFrame * CFrame.Angles(0, 0, math.rad(45))
toolButton.ViewportFrame.CurrentCamera = itemCamera
For some reason, when it clothes the item and then parents it to the viewport frame, it results in that object’s children (i.e. scripts, handles, parts, everything) to be deleted or just not carried along with it. I’ve tried about 10 different ways of cloning the item, to no avail.
Seems to only (or mostly only) happen to tools.