ViewportFrame Camera Isn't Being Created

  1. What do you want to achieve?
    Create a ViewportFrame inside an ImageLabel to show a model.

  2. What is the issue?
    The Camera object isn’t showing anywhere in the explorer but I can print the parent name of it.

  3. What solutions have you tried so far?
    Changing the camera parent.

local ViewportFrame = Instance.new('ViewportFrame')
local ViewportFrameCamera = Instance.new("Camera", ViewportFrame)
local UICorner = Instance.new('UICorner')

ViewportFrame.CurrentCamera = ViewportFrameCamera
ViewportFrame.BackgroundTransparency = 0
UICorner.CornerRadius = UDim.new(1,6)
UICorner.Parent = ViewportFrame

ViewportFrameCamera.CFrame = CFrame.new(Vector3.new(0, 2, 2), ViewportFrameModel.Handle.Position)
			
ViewportFrameModel.Parent = ViewportFrame
ViewportFrame.Parent = Slot
			
print(ViewportFrameCamera.Parent.Name)

This code prints ViewportFrame but there is no camera in the ViewportFrame.

local ViewportFrame = Instance.new('ViewportFrame')
local ViewportFrameCamera = Instance.new("Camera", ViewportFrame)
local UICorner = Instance.new('UICorner')

ViewportFrame.CurrentCamera = ViewportFrameCamera
ViewportFrame.BackgroundTransparency = 0
UICorner.CornerRadius = UDim.new(1,6)
UICorner.Parent = ViewportFrame

ViewportFrameCamera.CFrame = CFrame.new((ViewportFrameModel.Handle.CFrame * CFrame.new(0, 2, 2)).Position, ViewportFrameModel.Handle.Position)
			
ViewportFrameModel.Parent = ViewportFrame
ViewportFrame.Parent = Slot -- make sure slot is inside or is a ScreenGui or whatever gui you want
			
print(ViewportFrameCamera.Parent.Name)

Slot is inside a frame object.

Try setting the parent of the camera manually

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