Camera CFrame being laggy when using DeltaTime to move it

  1. What do you want to achieve?
    As I posted previously, I want to make a camera bobbing script.

  2. What is the issue?
    The camera seems to lag whenever I use DeltaTime to change its CFrame.
    It seems to take even a greater effect whenever I lower the FPS despite the DeltaTime not changing anything…?
    https://gyazo.com/0d3ad113762e4be0adc5eb1966f2a6a5

  3. What solutions have you tried so far?
    I looked around the forum but only a single post has been made 5 months ago, and it’s still unanswered.
    Plus I tried changing DeltaTime to another dynamic value (Humanoid’s speed and tick), but of course, it’s not giving the results I wish for.

le script

–// Services //–
local RunService = game:GetService(“RunService”)

–// Variables //–
local Camera = workspace.CurrentCamera

–// Bobbing
local Time = 0
local OldCFrame = CFrame.new()

–// Functions //–
RunService.RenderStepped:Connect(function(DeltaTime)
Time += DeltaTime

local Angle = math.sin(Time*2)*45

Camera.CFrame *= OldCFrame:Inverse()

local NewCFrame = CFrame.Angles(
	0,
	0,
	math.rad(Angle)
)
OldCFrame = NewCFrame

Camera.CFrame *= NewCFrame

end)

I’m not sure what to do anymore, my only option left is to ask here.
Thanks for reading :slight_smile:

1 Like