Weird behavior regarding the player's character

Anyone got any ideia on how to fix this behavior that my character starts having for no apparent reason?


(Issue is demonstrated after timestamp 0:12)

I’ve seen it in other games but never really cared, so I think its a common thing.
This is the script by the way:

workspace.ChildAdded:Connect(function(instance)
	wait()
	if instance:FindFirstChildOfClass("Humanoid") then
		local rot = instance:WaitForChild("HumanoidRootPart")
		local track = instance.Humanoid:LoadAnimation(game.ReplicatedFirst.Animation2)
		local track2 = instance.Humanoid:LoadAnimation(game.ReplicatedFirst.Animation)	
		rot.CFrame = CFrame.new(workspace.bed.tp.Position) * CFrame.Angles(0,math.rad(180),0) * CFrame.new(0,2.88,0)
		rot.Anchored = true
		instance.Humanoid.AutoRotate = false
		repeat wait() until track.Length > 0 and track2.Length > 0
		track:Play(-1,1,1)
		wait(track.Length + .2)
		track2:Play(-1,1,1)
		delay(2, function() track:Stop() end)
		track2:GetMarkerReachedSignal("rotanimating"):Connect(function()
			rot.CFrame = instance:WaitForChild("Torso").CFrame * CFrame.new(0,.5,0)
			track2:Stop(1)
			wait(1)
			rot.Anchored = false
			instance.Humanoid.AutoRotate = true			
		end)
	end
end)

I’m just trying to do some hacky solution for root motion (moving the humanoidrootpart through an animation), which for now has been going well imo.

This is usually related to objects inside your model (based off my experience), it’s a Roblox engine issue.

Or second guess: the animation being too distant from the RootPart, which is also a known issue, I believe