Lerping at constant speed in while loop

Soo the function is in while loop


and i need it to move at the same speed as it does when in the middle of it’s goal

You’re using an alpha time, so you can have a set in stone time to completion, for example 10 seconds. Make sure the while loop is aware of the time difference. Or, lerp a distance so it always moves at a specific magnitude.

It’s also worth checking out TweenService, you can store a Tween and pause it at any given point. Make sure to update startTime when starting a capture.

I’m currently on mobile, so I cannot provide a full example of this implantation, sorry!

local completionTime = 10
local startTime: number?
local tween: Tween?

local function getTimeRemaining()
    return math.clamp(tick() - startTime, 0, completionTime)
end