Restore saved animations [CLOSED]

Is there a way to save a state, position, velocity and animation timestamps etc of a character and then restore it? Am trying to make a checkpoint system for obbies yes

When using my (slightly vibe coded) solution the started animation starts fading away and in the clip the torso pushes back from the truss

local uis = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hum: Humanoid = char:WaitForChild("Humanoid")

local checkpoint

function addCheckpoint()
	local syncBridge = char:FindFirstChild("SyncAnimationState")
	local animName, timePos, speed = "idle", 0, 1

	if syncBridge then
		animName, timePos, speed = syncBridge:Invoke("Get")
	end

	checkpoint = {
		cframe = hum.RootPart.CFrame,
		velocity = hum.RootPart.AssemblyLinearVelocity,
		state = hum:GetState(),
		camera = workspace.CurrentCamera.CFrame,
		animName = animName,
		animTime = timePos,
		animSpeed = speed
	}
end

function teleport()
	if not checkpoint then return end

	hum.RootPart.CFrame = checkpoint.cframe
	hum.RootPart.AssemblyLinearVelocity = checkpoint.velocity
	workspace.CurrentCamera.CFrame = checkpoint.camera
	hum:ChangeState(checkpoint.state)

	local syncBridge = char:FindFirstChild("SyncAnimationState")
	if syncBridge then
		syncBridge:Invoke("Set", checkpoint.animName, checkpoint.animTime, checkpoint.animSpeed)
	end
end

uis.InputBegan:Connect(function(input, gameProcessed)
	if gameProcessed then return end

	if input.KeyCode == Enum.KeyCode.V then
		addCheckpoint()
		print("Checkpoint Saved: " .. (checkpoint.animName or "None"))
	elseif input.KeyCode == Enum.KeyCode.R then
		teleport()
	end
end)
-- emote bindable hook in Animate
local syncAnims = Instance.new("BindableFunction")
syncAnims.Name = "SyncAnimationState"
syncAnims.Parent = script.Parent

syncAnims.OnInvoke = function(mode, animName, timePos, speed)
	if mode == "Get" then
		-- returns the current state name
		return currentAnim, currentAnimTrack and currentAnimTrack.TimePosition or 0, currentAnimSpeed
	end

	if mode == "Set" then
		playAnimation(animName, 0, Humanoid) -- call builtin function

		if currentAnimTrack then
			currentAnimTrack.TimePosition = timePos
			setAnimationSpeed(speed) -- call builtin speed function
		end
		return true
	end
	return false
end

When restoring a climbing position torso is slightly moved back so the HRP is inside a truss, but when the climbing animation is already running it teleports perfectly, not completely sure how the animate script works