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 Color3.new(1, 1, 1)
-- VIEWPORT FRAME RELATED
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 = Instance.new("Camera")
ViewportCamera.Name = (PetModel.Name.."Camera")
ViewportCamera.Parent = ViewportFrame
local CameraPosition = PrimaryPosition + Vector3.new(0, 0, 12)
local ViewingPosition = PrimaryPosition
ViewportFrame.CurrentCamera = ViewportCamera
ViewportFrame.CurrentCamera.CFrame = CFrame.new(CameraPosition, ViewingPosition)
-- DEBUGGING PRINTS
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)
end
else
warn("Pet model not found for: " .. Pet.Name)
end
InRange(BillboardClone)
end
end
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.