#how do I set a viewports currentCamera to the players camera

10 messages · Page 1 of 1 (latest)

normal bison
#
local camera = game.Workspace.CurrentCamera
local wall = game.Workspace.GlassDisplay
local surfaceGui = wall.SurfaceGui
local viewportFrame = surfaceGui.ViewportFrame

-- Function to update the ViewportFrame's CFrame
local function updateViewportFrameCFrame()
    viewportFrame.CurrentCamera = camera
end

-- Connect the function to run on a recurring basis
game:GetService("RunService").RenderStepped:Connect(function()
    updateViewportFrameCFrame()
end)```
#

**Make sure that the viewportFrame variable is correctly assigned to the ViewportFrame object in your hierarchy Additionally, ensure that the updateViewportFrameCFrame function is being called consistently to update the CurrentCamera property of the ViewportFrame

If the viewport is still not updating when the player move, you may need to check if there are any other scripts or settings that are interfering with the camera or viewport behavior**

gray dome
#

it still doesnt work

normal bison
#

any errors?

gray dome
#

no, it just simply doesnt display on the part

#

in studio it will look like that

#

but in game it will not be there

#

the white bg with the red part in the middle is the surfacegui

ebon lichen
#

viewportframes can only display parts that are parented to them