Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Camera script is displaying the camera below the map?

Not quite sure how cameras work. I try to display the camera as shown below, but the view is below the map.

--Setup variables
local cameras = game.Workspace.CCTVCams:GetChildren()
local cameraSelected = 1
local camera = game.Workspace.CurrentCamera

--Function to update the camera
local function updateCam(camNum)
    local camPart = cameras[camNum].CamPart
    camera.CameraType = Enum.CameraType.Scriptable
    camera.CameraSubject = camPart
    
    camera.CoordinateFrame = CFrame.new(camPart.Position)
    camera.Focus = CFrame.new(camPart.Position)
end

updateCam(1)

1 comment

0

I havent worked with cameras to much, but ill recommend two things. One, change the function to a renderStepped function. That way it runs on FPS not time. And second remove camera.Focus ive personally never had any luck with it. Also change "camera.CoordinateFrame" to "camera.CFrame"

1 answer

✓ Accepted answer
--Setup variables
local cameras = game.Workspace.CCTVCams:GetChildren()
local cameraSelected = 1
local camera = game.Workspace.CurrentCamera

--Function to update the camera
local function updateCam(camNum)
    local camPart = cameras[camNum].CamPart
   local target = camPart
local cam = workspace.CurrentCamera
cam.CameraType = Enum.CameraType.Scriptable
cam.CameraSubject = camPart
	
cam.CoordinateFrame = CFrame.new(target.Position)
end

updateCam(1)

Try using this.

This discussion is preserved as it was. New answers, comments, and votes are closed.