This is pretty simple.
local character = characterInstance — define this yourself
local animation = character.Humanoid:LoadAnimation(animationInstance)
animation:Play()
character.HumanoidRootPart.Anchored = true — anchor after the animation starts playing
animation.Stopped:Wait() — wait until the animation stops, you can connect a functio(n) instead if you don’t want to yield the code
character.HumanoidRootPart.Anchored = false — unanchor the HumanoidRootPart after the code is done waiting for the animation to stop