Model gets automatically deleted when unanchored

So I have a simple block of code that’s responsible for duplicating a tool as a model and putting it in the workspace.

This looked promising on my first attempt when I left the handle (primarypart) anchored for debugging, but everytime I’d make it unanchored the whole model just gets deleted, not fall or anything, straight up deleted.
(I’m pretty sure even if it were to fall through the baseplate, the model wouldn’t get deleted)

bug

function module.spawnItem(Tool : Tool, Cframe : CFrame)
	local ToolHolder = Instance.new("Model")
	ToolHolder.Parent = workspace
	
	for _, p in pairs(Tool:GetChildren()) do
		if p:IsA("BasePart") then
			local v = p:Clone()
			
			local isPrimaryPart = false
			if Tool.PrimaryPart == p then
				isPrimaryPart = true
			end
			
			v.Parent = ToolHolder
			v.CanCollide = true
			v.CollisionGroup = "Default"
			v.Name = "Part"
			v:ClearAllChildren()
			v:SetNetworkOwner(nil)
			if isPrimaryPart then
				ToolHolder.PrimaryPart = v
			end
		end
	end
	
	Tool:Destroy()
	
	ToolHolder:PivotTo(Cframe)
	ToolHolder.PrimaryPart.Anchored = true -- exists normally
	task.wait(3) 
	ToolHolder.PrimaryPart.Anchored = false -- gets deleted instantly
end

Just to be clear, this snippet is the only block of code that interacts with ToolHolder, the tool itself isn’t anything complicated, just one part, 0 constraints. And yeah the baseplate was at 0 0 0.

I also tried disabling streaming but to no avail.

So far my only clue is some sort of engine bug but I’d be glad to be proven otherwise.

Are you doing that on the client? Perhaps the part is anchored on the client but the part falls into void on the servers end?

1 Like

I just checked, yea it is indeed the server.
I’m pretty sure when parts fall through the baseplate their model dosent get deleted either way.

If it’s the last part within the model that gets destroyed by the void, the model will also get destroyed. Source

Also make sure to give the check to mitex as he solved your problem

it was in the server not the client, I did check that

(you can see in the bottom the remote event that triggers it

function module.spawnItem(Tool : Tool, Cframe : CFrame)
	local ToolHolder = Instance.new("Model")
	ToolHolder.Parent = workspace
	
	for _, p in pairs(Tool:GetChildren()) do
		if p:IsA("BasePart") then
			local v = p:Clone()
			
			local isPrimaryPart = false
			if Tool.PrimaryPart == p then
				isPrimaryPart = true
			end
			
			v.Parent = ToolHolder
			v.CanCollide = true
			v.CollisionGroup = "Default"
			v.Name = "Part"
			v:ClearAllChildren()
			v:SetNetworkOwner(nil)
			if isPrimaryPart then
				ToolHolder.PrimaryPart = v
			end
		end
	end
	
	Tool:Destroy()
	
	ToolHolder:PivotTo(Cframe)
	ToolHolder.PrimaryPart.Anchored = true
	task.wait(3)
	ToolHolder.PrimaryPart.Anchored = false
end


DropToolEvent.OnServerEvent:Connect(function(Player, Tool)
	local Character = Player.Character
	local HRP = Character.HumanoidRootPart
	
	local inFrontCFrame = HRP.CFrame * CFrame.new(0, 0, -3.5)
	
	module.spawnItem(Tool, inFrontCFrame)
end)