Viewport frame for model is only showing the primary part

I set up a viewport frame for my model and it’s only showing the primary part in the frame even though the entire model is there.

			quickslotItemFrame = quickslotScrollingFrame.QuickslotItemFrame:Clone()
			quickslotItemFrame.LayoutOrder = #quickslotScrollingFrame:GetChildren() + 1
			quickslotItemFrame.Name = itemName
			quickslotItemFrame.Visible = true
			quickslotItemFrame.Parent = quickslotScrollingFrame

			quickslotItemFrame.TextButton.Text = itemName
			
			viewportFrame = quickslotItemFrame.ViewportFrame
			viewportFrame.Amount.Text = tostring(amount)
			
			local viewportCamera = Instance.new("Camera")
			viewportCamera.Parent = viewportFrame
			
			viewportFrame.CurrentCamera = viewportCamera
			
			local itemModel = client.Assets.QuickslotItems[itemName]:Clone()
			itemModel.PrimaryPart.Anchored = true
			itemModel.PrimaryPart.Position = Vector3.new(0, 4, 0)
			itemModel.Parent = viewportFrame
			
			viewportCamera.CFrame = CFrame.lookAt(Vector3.new(0, 4, 1), itemModel.PrimaryPart.Position)

I think it’s because you moved only PrimaryPart to right Position, not model. Try to change this:

itemModel.PrimaryPart.Position = Vector3.new(0, 4, 0)

To this:

itemModel:MoveTo(Vector3.new(0, 4, 0))

With models you should use PivotTo instead, it ignores collisions if there is anything in the way

itemModel:PivotTo(CFrame.new(Vector3.new(0,4,0)))
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.