Why is my viewport frame being black?

I am attempting to make my viewport frame show a pet but for some reason the pet inside is completely black even though I used the same method for the one in the list and it works fine.

here is the code that creates the camera:

local IconCamera = Instance.new("Camera")
IconCamera.Parent = PetInventoryUI.Main.PetIcon.PetViewport
PetInventoryUI.Main.PetIcon.PetViewport.CurrentCamera = IconCamera

here is the code that adds the pet

petModel = ReplicatedStorage.Pets[petData.petType]:Clone()
 petModel.Parent =  PetInventoryUI.Main.PetIcon.PetViewport
petModel.CFrame = IconCamera.CFrame + (IconCamera.CFrame.LookVector * 3) 
 petModel.CFrame = PetModel.CFrame * CFrame.Angles(0, math.rad(115), 0)
1 Like

Are you ever setting the camera’s CameraType to Enum.CameraType.Scriptable? You should do that right after creating the camera.

This is not necessary for ViewportFrame Cameras.

2 Likes

Check the light color, light direction and image color

Did you actually instance or make a viewport frame? Because I’m pretty sure viewport frames and standard guis are two separate classes.

Just for testing purposes try instancing a viewportFrame and see if it works.
Like this:

local viewportFrame = Instance.new("ViewportFrame", parent) -- put what the viewportFrame is gonna be instanced into

Fool around with the size, BackgroundTransparency, Position and other properties. And try defining the IconCamera’s CFrame.