✓ Accepted answer
Scriptable camera does not move automatically, you'd have to update its position and orientation every frame. Before you do that, check out other camera types, to make sure none of them are what you are looking for:
Camera Types
If none of them are to your liking, you'd have to connect your camera function to RenderStepped(). Why not wait() loop or Heartbeat()? Because RenderStepped will execute, before rendering and it is recommended for (and only) camera manipulation. Below LocalScript will create overhead camera.
cam = game.Workspace.CurrentCamera
cam.CameraType = Enum.CameraType.Scriptable
cam.CameraSubject = workspace
local RunService = game:GetService("RunService")
local Players = game:getService("Players")
local character = Players.LocalPlayer.character or player.CharacterAdded:wait()
local root = character:WaitForChild("HumanoidRootPart")
local riseVector = Vector3.new(0,20,0)
local function onRenderStep()
cam.CFrame = CFrame.new(root.Position + riseVector,root.Position)
end
RunService.RenderStepped:Connect(onRenderStep)
1 comment
The second argument of a CFrame() is the lookat position. Like this: CFrame.new(Position,LookAt). What you can do if you want the camera to look 10 studs above the object is: Cam.CFrame = CFrame.new(pos, lookAt + vector3.new(0,10,0))