Cloning Model doesn't copy PrimaryPart

Hi, im trying to clone a model and move it to a specific position.

	if raycastResult then
		local part = game.Workspace.Ores.Ore:Clone() --This is a model, i set the primary part manually.
		part.Parent = game.Workspace.SpawnedOres
		local newCFrame = CFrame.new(raycastResult.Position)
		part:SetPrimaryPartCFrame(newCFrame)
		print("spawned")
	end

If i use part:SetPrimaryPartCFrame(newCFrame) it gives me an error saying that the model DOESN’T have a Primary Part.
If i delete SetPrimaryPart… then it just copies an empty model.

image image

Anyone knows how to fix?

Try some debugging,
print(game.Workspace.Ores.Ore:GetChildren()) before cloning.
Ensure that the children is there

I think you have to call MakeJoints() in order to properly create the Model properly in relevance to its PrimaryPart, perhaps try this?

	if raycastResult then
		local part = game.Workspace.Ores.Ore:Clone() --This is a model, i set the primary part manually.
		part.Parent = game.Workspace.SpawnedOres
        part:MakeJoints()

		local newCFrame = CFrame.new(raycastResult.Position)
		part:SetPrimaryPartCFrame(newCFrame)
		print("spawned")
	end

All you have to do is define the PrimaryPart property it should look something like this:

if raycastResult then
		local part = game.Workspace.Ores.Ore:Clone() --This is a model, i set the primary part manually.
        part.PrimaryPart = part.Ore
		part.Parent = game.Workspace.SpawnedOres
		local newCFrame = CFrame.new(raycastResult.Position)
		part:SetPrimaryPartCFrame(newCFrame)
		print("spawned")
end

I found the issue, i had a collection service loop and it kept breaking my stuff. Sorry everyone, my bad.