I have a script that can anchor the player while the animation runs but don’t have any idea on how to keep the player unanchored when the animation ends, Any suggestions?
local Animation = script.Animation:Clone()
Animation.Parent = Character.HumanoidRootPart
if Animation:Play() then
Humanoid.WalkSpeed = 0 and Character.HumanoidRootPart.Anchored == true else return
end```
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