Camera script not working

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I have a script for setting the player’s camera, but the script does not work.

  2. What is the issue? Include screenshots / videos if possible!
    The script changes the CameraType to Scriptable, but it does not change the Camera.Focus.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    None

Script:

local camera = workspace.CurrentCamera
camera.Focus = CFrame.new(workspace.CutsceneRoom.CameraPosition1.Position, workspace.CutsceneRoom.CameraFocus1.Position)
camera.CameraType = Enum.CameraType.Scriptable
camera.Focus = CFrame.new(workspace.CutsceneRoom.CameraPosition1.Position, workspace.CutsceneRoom.CameraFocus1.Position)
-- Should actually be
camera.CFrame = workspace.CutsceneRoom.CameraPosition1.CFrame

-- This is because you need to set CFrame to CFrame

Edit:

-- Move this BEFORE setting it
camera.CameraType = Enum.CameraType.Scriptable

Final:

local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = workspace.CutsceneRoom.CameraPosition1.CFrame
2 Likes
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = CFrame.lookAt(workspace.CutsceneRoom.CameraPosition1.Position, workspace.CutsceneRoom.CameraFocus1.Position)
1 Like

When I do this, the screen is just the grey of the walls in the map.

Probs because its…

  • Unanchored
  • The wrong part
  • The face is wrong

For now, use the other solution

1 Like