function Animation.TweenFoV(Zoom, Duration)
spawn(function()
local NewCode = math.random(-1e9, 1e9)
FoVCode = NewCode
local CurrentTime = 0
local LastTime = tick()
while true do
if FoVCode ~= NewCode or CurrentTime >= Duration then break end
local DeltaTime = tick()-LastTime
LastTime = tick()
CurrentTime = CurrentTime + DeltaTime
local Alpha = CurrentTime/Duration
if Alpha > 1 then Alpha = 1 end -- Make sure we don't go over.
Camera.FieldOfView = Lerp(Camera.FieldOfView, Zoom, Alpha)
RunService.RenderStepped:wait()
print(CurrentTime)
end
end)
end
This loop should Tween the FOV of the camera to target "Zoom" in time "duration". When I run this code, the FOV will tween but not in the correct amount of time.
The FOV will equal Zoom in about half the time set by duration.
I don't see why this shouldn't work and work properly.
Edit: Here is my Lerp function.
function Lerp(Start, Finish, Alpha)
return Start + Alpha * (Finish - Start)
end

4 comments
I have confirmed that Alpha = 1 when CurrentTime = Duration.
You're lerping the camera's FOV from the Current FOV, you should get that data and then put it in there (line 20)
Ah, I see now. Thank you!
That fixed it.