local oldOffset = CFrame.new() -- Don't edit this!
local offset = CFrame.new()
-- (Optional): Will accumulate the time in seconds since the script started
local t = 0
game:GetService("RunService").RenderStepped:Connect(function(delta)
-- (Optional): Accumulate the time in seconds
t += delta
-- Cancel out the offset we applied in the previous frame
cam.CFrame *= oldOffset:Inverse()
-- Apply the new offset
cam.CFrame *= offset
-- Store the offset we have applied so we cancel it in the next frame
oldOffset = offset
-- Update the offset that will applied!
offset = CFrame.Angles(math.sin(t), 0, 0) --You can change this however you want!
-- Proof (Optional): You can update the original cframe without affecting the offset
cam.CFrame *= CFrame.new(math.sin(t)*10, 0, 0) --You can change this however you want!
end)
This gives you a relative cframe that you can play with without overriding the original camera cframe.
If you’re interested, I can make it as a robust function for you!