Viewport Frame not showing Pet Model!

I want my Viewport Frame to show my Pet Model.

My Viewport Frame is not showing my Pet Model

I’ve looked at the Roblox Developer Forum, and have looked at some videos explaining Viewport Frames, I’ve also used AI, but it cannot find the problem.

My pet has a PrimaryPart, it’s name is “Body”
The Viewport Frame CurrentCamera is set to the Camera inside of the Viewport.
The Viewport Sizing is the 1,0,1,0 (in other words same size as its parent Frame)

This is a part of the function that handles the Viewport Frame showing.

			for _, Pet in pairs(Pets) do
		local PetEgg = PetsFolder:FindFirstChild(ClosestEgg.Name)
		local PetModel = PetEgg:FindFirstChild(Pet.Name)
		local PetTemplate = MainFrame:FindFirstChild(Pet.Name)
		if PetModel then
			if not PetTemplate then
				PetTemplate = PetTemplates.Template:Clone()
				PetTemplate.Parent = MainFrame
				PetTemplate.Name = Pet.Name
				local ChanceLabel = PetTemplate:FindFirstChild("Chance")
				ChanceLabel.Text = tostring(Pet.Chance) .. "%"
				ChanceLabel.TextColor3 = RarityColors[Pet.Rarity] or, 1, 1)
				local ViewportFrame = PetTemplate:FindFirstChild("ViewportFrame")
				local PetClone = PetModel:Clone()
				local PetPrimary = PetClone.PrimaryPart or PetClone:FindFirstChild("Body")
				local PrimaryPosition = PetPrimary.Position
				PetClone.Parent = ViewportFrame
				local ViewportCamera ="Camera")
				ViewportCamera.Name = (PetModel.Name.."Camera")
				ViewportCamera.Parent = ViewportFrame
				local CameraPosition = PrimaryPosition +, 0, 12)
				local ViewingPosition = PrimaryPosition
				ViewportFrame.CurrentCamera = ViewportCamera
				ViewportFrame.CurrentCamera.CFrame =, ViewingPosition)
				print("PetClone:", PetClone.Name)
				print("PrimaryPart:", PetPrimary.Name)
				print("PrimaryPart Position:", PetPrimary.Position)
				print("CameraPosition:", CameraPosition)
				print("ViewportFrame Size:", ViewportFrame.Size)
				print("Camera CFrame:", ViewportCamera.CFrame)
			warn("Pet model not found for: " .. Pet.Name)

Here is a screenshot of my Workspace, and the issue.


I would appreciate any help / feedback that you could give me!

If you have any questions, I would be happy to reply.

I’ve done some more experimenting, but I can’t find what’s wrong.
Everything seems to be correct. I even made a different script just to test it.

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local Template = script.Parent

local ViewportFrame ="ViewportFrame")
ViewportFrame.Name = "ViewportFrame"
ViewportFrame.Parent = Template
ViewportFrame.Size =, 0, 1, 0)
ViewportFrame.BackgroundTransparency = 1

local Camera ="Camera")
Camera.Name = "PetCamera"
Camera.Parent = ViewportFrame

local PetFolder = ReplicatedStorage:FindFirstChild("Pets")
local EggFolder = PetFolder:WaitForChild("Basic Egg")
local Pet = EggFolder:FindFirstChild("Bunny")

if Pet then
	local PetClone = Pet:Clone()  -- Clone the pet model
	PetClone.Parent = ViewportFrame

	local PrimaryPart = PetClone.PrimaryPart or PetClone:FindFirstChild("Body")

	if PrimaryPart then
		local PrimaryPosition = PrimaryPart.Position

		-- Adjust the camera position and look at the pet
		local CameraPosition = PrimaryPosition +, 2, 12)
		local LookAtPosition = PrimaryPosition

		ViewportFrame.CurrentCamera = Camera
		ViewportFrame.CurrentCamera.CFrame =, LookAtPosition)
		warn("Primary part not found for pet model")
	warn("Couldn't find pet")

Heres the ViewportFrame with that btw.

1 Like

Boost, Since I still haven’t gotten help! I’ve tried a ton of things!