Point the camera anywhere you want with a LocalScript — the foundation of cutscenes, cinematic views, and locked-camera puzzles.
The camera is your 's view of the world — and by default, Roblox drives it. The character follows, the mouse looks around, all automatic. Custom cameras take the wheel: you decide exactly where the view sits and where it points. Cutscenes, boss-intro pan shots, locked-camera puzzles, first-person views — they all start with the same five lines.
Every has one camera, and you get it from :
local camera = workspace.CurrentCamera
CurrentCamera — the active camera for this .StarterPlayerScripts. One zooming to a tower must never tilt someone else's view.Where does a custom camera script live, and why?
The engine ignores your assignments as long as it's in charge. Switch it off:
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = CFrame.new(0, 30, 40)
CameraType.Scriptable — "a owns the camera now."camera.CFrame — where the camera stands and which way it faces.From this moment the mouse and the character no longer move the camera. You set the , the camera obeys.
Setting camera.CameraType to tells the engine a script owns the camera now.
CFrame.new(0, 30, 40) puts the camera high above the world — but it keeps whatever direction it was already facing. To point it, use lookAt:
camera.CFrame = CFrame.lookAt(Vector3.new(0, 30, 40), castle.Position)
Two arguments: where the camera stands, then what it looks at. If the target moves, the camera keeps staring at its old spot — which is why real camera re-aim every frame (next step).
Aim the camera at castle.Position from the point (0, 30, 40). Write the line.
-- aim the camera at the castle
Aim once and a moving target walks out of frame. The fix: re-aim every frame. RenderStepped fires right before the game renders — the correct home for camera math:
local RunService = game:GetService("RunService")
local camera = workspace.CurrentCamera
local target = workspace.Coin
RunService.RenderStepped:Connect(function()
camera.CFrame = CFrame.lookAt(camera.CFrame.Position, target.Position)
end)
camera.CFrame.Position — "where the camera already stands." Pass that plus the moving target, and the camera swings to follow the coin however it moves.
RenderStepped runs on the client before every rendered frame. That's where smooth camera work goes — a while true with task.wait is too chunky for a camera.
Inside the RenderStepped handler, write the line that keeps the camera looking at target.Position from where it already stands.
RunService.RenderStepped:Connect(function()
-- keep the camera aimed at the target
end)
camera.CFrame = CFrame.new(0, 30, 40) teleports the camera but keeps the old facing. Point it with lookAt.camera.CFrame = flicker. One camera, one writer at a time.camera.CFrame = Vector3.new(0, 30, 40)
Type the corrected line — CFrame needs a CFrame, not a bare Vector3.
Next: chaining scripted moves into a full cutscene.