My Tweening system breaks when the game is frozen

Guys I need help with my code my issue is that when a tween is completed and the user’s game is frozen the other tweens don’t play why is this?

function module.Move(mob, HumanoidOffset)
    local nodesFolder = workspace.Map:FindFirstChildOfClass("Folder"):FindFirstChild("Nodes")
    local mobRoot = mob.PrimaryPart

    for node=1, #nodesFolder:GetChildren() do	
		local DistanceFromMob = (mobRoot.Position - nodesFolder[node].Position).magnitude * mob:GetAttribute("Speed") * .01 -- Calculates the rate at how fast the mob should move tween at.
		local humanoid = mob:FindFirstChild("Humanoid")

		local TweenPos = nodesFolder[node].CFrame + Vector3.new(0,HumanoidOffset,0)
		local MobMoveTween = TweenService:Create(mobRoot,TweenInfo.new(DistanceFromMob,Enum.EasingStyle.Linear),{CFrame = TweenPos})

		MobMoveTween:Play()

		local function onMobDied()
			MobMoveTween:Pause()
			module.Remove(mob)
			warn("Mob died.")
		end

		humanoid.Died:Connect(onMobDied)

		MobMoveTween.Completed:Wait()
		cPrint("Tweening " .. mob.Name .. " to Node: " .. node .. " is comepleted.",1)
    end

    module.Remove(mob) --Removes the mob from the game and also deducts damage from the base if the mob has reached the end part  of the track.
end

Probably because they rely on RunService.RenderStepped Or Heartbeat if you are on the server. If the game is frozen no new frames will be loading causing the halt in the tweening.

This is actually all done on the client in a module script there is no render stepped being used here.

I’m not sure why tweening breaks for you when your game is frozen, but you shouldn’t be tweening NPCs to move them to different spots. If your nodesFolder is a collection of parts that make out a path with no jumps, you should be able to use :MoveTo() on the zombie’s Humanoid.

Here’s a version of your code that uses :MoveTo(). I’m not sure of your needs, so I removed some parts like the HumanoidOffset variable since :MoveTo() doesn’t make the character move to the exact location specified.

function module.Move(mob)
	local nodesFolder = workspace.Map:FindFirstChildOfClass("Folder"):FindFirstChild("Nodes")
	local mobRoot = mob.PrimaryPart
	local humanoid = mob:FindFirstChild("Humanoid")
	
	-- Since declaring a function and connecting it to an event every time the loop runs is unnessesary, we only just have to do it once outside the loop.
	local function onMobDied()
		module.Remove(mob)
		warn("Mob died.")
	end
	humanoid.Died:Connect(onMobDied)

	for node=1, #nodesFolder:GetChildren() do	
		local DistanceFromMob = (mobRoot.Position - nodesFolder[node].Position).Magnitude * mob:GetAttribute("Speed") * .01
		humanoid.WalkSpeed = DistanceFromMob -- Assuming the Speed attribute controls the humanoid WalkSpeed I made it so the WalkSpeed is set to DistanceFromMob.
		
		humanoid:MoveTo(nodesFolder[node].Position) -- This makes the humanoid try it's best to move to the position of the node
		humanoid.MoveToFinished:Wait()
		
		cPrint("Moving " .. mob.Name .. " to Node: " .. node .. " is completed.",1) -- Just a note: I'm not sure why you need a custom function for printing. print() should work just as well. 
		-- You can access your prints by pressing F9 in-game and clicking the Server button, or opening the Output window in the View tab of Studio to view your prints while the game is running.
	end 

	module.Remove(mob)
end

From my knowledge, I don’t think a NPC moving by itself should stop whenever you freeze the game, but I’m not too sure.

Try out this code, and if it doesn’t work for whatever reason reply to this message. Hope I helped you out.

I actually avoided using this method but I might try it again Thx.