Trouble with putting models inside a viewport

I was making an inventory GUI with viewport frames, and I can’t figure out what I’m doing wrong. I have spend much time trying to figure out, thank you.

function create(name)
	-- template is the viewport
	local modelclone = sticklibrary[name].Model:Clone()
	local grr = Instance.new("Model")
	local cam = Instance.new("Camera")
	local template = script.Template:Clone()
	template.Name = sticklibrary[name].Name
	local f = modelclone:GetChildren()
	for d = 1, #f do
		f[d].Parent = grr
	end
	modelclone:Destroy()
	cam.CFrame = CFrame.new(Vector3.new(0, 2, 12), Vector3.new(grr:GetPivot().X,grr:GetPivot().Y,grr:GetPivot().Z))
	cam.Parent = template
	grr.Parent = template
	template.CurrentCamera = cam
	template.Parent = script.Parent.Background.InventoryContents
	
end

FYI, the reason I destroyed “modelclone” is because it was a part acting like a model, so I switched it to make it an actual model.

Do the models show up in the explorer?

Also, I believe this may be changed to CFrame.new(Vector3.new(0, 2, 12), grr:GetPivot().Position)

Models do show up in the explorer, when I just do grr:GetPivot(), thats a CFrame and its asking for a vector3 value

the model grr is not yet parented to anything yet when you use GetPivot(). The function GetPivot() is a function of PVInstance:


grr doesnt have a location until you parent it to the template which you do after setting the cam’s CFrame.

Thank you for your response, the models are still not appearing, but that’s one step closer.