Im trying to rotate the camera around the focus point. I have this for far,
local cf = CFrame.new(cam.CoordinateFrame.lookVector*40)*CFrame.Angles(0,math.rad(rot),0)*CFrame.new(0,40,40) local fc = CFrame.new(cam.CoordinateFrame.lookVetcor*40) cam.CoordinateFrame = CFrame.new(cf.p,fc.p) rot = rot + 45
but it doesn't work and I don't know why?
You should look at the Wiki for Camera Manipulation! They teach and example of how to make your camera rotate around a part while teaching you about Camera Manipulation.
Here's the script they give anyway:
local target = workspace.Part local camera = workspace.CurrentCamera camera.CameraType = Enum.CameraType.Scriptable camera.CameraSubject = target local angle = 0 while wait() do camera.CoordinateFrame = CFrame.new(target.Position) --Start at the position of the part * CFrame.Angles(0, angle, 0) --Rotate by the angle * CFrame.new(0, 0, 5) --Move the camera backwards 5 units angle = angle + math.rad(1) end
You can learn even more with the link to Camera Manipulation Here!