I made a system that moves models to waypoints using times to get the percent it should be at and use lerp to calculate the position. The problem is randomly and pretty rare the model position would turn to a position that looks like NaN

I tried using prints to make sure the percent is not NaN but nothing has worked so far
the moveStats table looks like this
{
tick(),--start time
Time, --Time to reach destination
CFrame.new(position) --goal destination
}
Here is the code to move the entities any help is appreciated don’t think the whole code is necessary but if you would like to see more please lmk!
Note the print does NOT run at all even when the position goes to that weird number
RunService.Heartbeat:Connect(function ()
local cframes = {}
local hrps ={}
for id, data in Data do
if data.waypoints then
local waypoints = data.waypoints
local waypoint = data.waypoint
local moveStats = data.MoveStats
local currentTime = tick()- moveStats[1]
local percent = currentTime/moveStats[2]
local primaryPart = data.Model.PrimaryPart
if percent >= 1 or percent ~= percent or currentTime <= 0 then
--doing if percent ~= percent as a method to check for nan
if percent ~= percent or currentTime <= 0 then
print('something weird happened', percent, currentTime, moveStats[1], moveStats[2])
end
currentTime = tick() - moveStats[1]
reachWaypoint(data, currentTime-moveStats[2])
continue
end
local p =waypoints[waypoint]
local n = #cframes+1
cframes[n] = moveStats[3]:Lerp(p, percent)
hrps[n] = primaryPart
end
end
if #cframes == #hrps then
workspace:BulkMoveTo(hrps, cframes, Enum.BulkMoveMode.FireCFrameChanged)
end
end)```