Animation stuck only in other clients when you alt tab

Hello. If a player alt tabs while they are running and they do not stop pressing W before the page is alt tabbed completely then their running animation gets stuck ONLY in other clients. They look fine in their own screen, but for others they are stuck in the run animation. What could be the reason? Here is the script that handles the animation:

local runAnim = humanoid.Animator:LoadAnimation(character:WaitForChild("Animate"):WaitForChild("run"):WaitForChild("RunAnim"))
local walkId = id
local runId = id

function startRun()
	if isRunning.Value then return end
	if isDowned.Value then return end
	RunEvent:FireServer("Start")
	
	for _, track in pairs(humanoid:GetPlayingAnimationTracks()) do
		if track.Animation.AnimationId == runId then
			track:Stop()
			track:Destroy()
		end
	end
	
	character:WaitForChild("Animate"):WaitForChild("walk"):WaitForChild("WalkAnim").AnimationId = runId
	humanoid:ChangeState(Enum.HumanoidStateType.Landed)
end

function stopRun()
	RunEvent:FireServer("Stop")
	
	for _, track in pairs(humanoid:GetPlayingAnimationTracks()) do
		if track.Animation.AnimationId == walkId then
			track:Stop()
			track:Destroy()
		end
	end
	
	character:WaitForChild("Animate"):WaitForChild("walk"):WaitForChild("WalkAnim").AnimationId = walkId
	humanoid:ChangeState(Enum.HumanoidStateType.Landed)
end

I added the part that destroys the previous track as an attempt to fix the issue but it did not work. It is a local script. Thanks in advance.

How do I set the new animation as the walking/idle etc animation after that? The only way I can think of is doing it manually like setting the new walking animation’s priority higher than the default one and playing it while the character is moving.