You can get the frame time (dt) from the parameters passed to RenderStepped or Stepped or Heartbeat, or from the return value of task.wait()/wait(), whatever you’re using.
camera.CFrame = camera.CFrame * CFrame.Angles(0, math.rad(-.1) 20, 0)
end
function rightEnd()
end```
that is pretty much the entire right bit (its constantly fired when the player presses d)
if (humanoid.MoveDirection:Dot(camera.CFrame.RightVector) > 0.37) or (humanoid.MoveDirection:Dot(camera.CFrame.RightVector) > 0.85) then
-- print("we're going right")
right()
elseif not isleftdown then
isRightdown = false
rightEnd()
end
if (humanoid.MoveDirection:Dot(camera.CFrame.RightVector) <- 0.37) or (humanoid.MoveDirection:Dot(camera.CFrame.RightVector) <- 0.85) then
-- print("we're going left")
left()
elseif not isRightdown then
isleftdown = false
leftEnd()
end
doforwarding()
end```
As @nicemike40 suggested, dt would be a reasonable approach. dt stands for delta-time, it’s a return variable of Heartbeat, Stepped, & RenderStepped. dt tells you how many fractions of a second have elapsed since the previous frame.
If you hook your CFrame rotation to a RenderStepped function you could easily implement this like so:
local RS = game:GetService("RunService")
local rotationRate = 15
RS.RenderStepped:Connect(function(dt)
camera.CFrame *= CFrame.Angles(0, math.rad(rotationRate) * dt, 0)
end)