My animation refuses to stop after it ends

I have made a animation
this is how it originally looks like :


but when i try it with this script

local Animation = script.Parent.Animation
local ResetAnim = script.Parent.ResetAnim
script.Parent.CustomPos.ProximityPrompt.Triggered:Connect(function(player)
	Animation.AnimationId = "rbxassetid://15759597658"
	local Humanoid = player.Character:FindFirstChildOfClass("Humanoid")
	local Root = player.Character:FindFirstChild("HumanoidRootPart")
	Root.CFrame = script.Parent.StartAnim.CFrame
	Root.Anchored = true
	local Animation2 = Humanoid:WaitForChild("Animator"):LoadAnimation(Animation)
	Animation2.Looped = false
	Animation2:Play()
	game.ReplicatedStorage.AnimState:FireClient(player,true)
	Animation2.Priority = Enum.AnimationPriority.Movement
	--Animation2.Stopped:Once(function()
	--	--Animation2:Stop(0.000000000000000000000000000000000000000000000000000000000001)
	--	Animation.AnimationId = 0
	--end)
	task.wait(1.64 - 0.01)
	Animation2:Stop(0.000000001)
	
	game.ReplicatedStorage.AnimState:FireClient(player,false)
	Root.Anchored = false
	task.wait()

	Root.CFrame = script.Parent.EndAnim.CFrame
end)

it flings me around when i turn almost like its still playing the animation after
here is a video example of me trying it


i have tried so many things to fix it the only thing that seems to fix it is if i make every part of my body massless but yet again it acts like im on a floor with ice after and my walking animations sometimes speed up like im still being flung but not

1 Like

Yeah when you move the humanoid root part too much that seems to happen for some reason, maybe try actually moving the character itself from like a AnimationEvent

edit: Oh your actually moving the humanoid root part itself through script, in that case @yoshicoolTV has got the right idea, you should move the whole model not just the humanoid root part; thats whats creating that offset

its my first time trying to animate so i dont exactly know what animation event is but
the only thing that seems to fix it is that if i make my character massless and make it not massless again seems to fix it
but it doesn’t seem to be the original problem
i just need to make the velocity reset for the character

1 Like

Try using PivotTo
Instead of

	Root.CFrame = script.Parent.EndAnim.CFrame

Do this

	player.Character:PivotTo(script.Parent.EndAnim.CFrame)
1 Like

i tried this but this is what happens :


also it doesn’t fix the velocity issue

In your explorer check where the humanoidrootpart is like in the character, lets see where it actually is relative to where it should be


as you can see the humanoidrootpart is where it should be
what i think is happening is that the torso or the humanoidrootpart have some sort of velocity changed and makes it fling me when i turn around

1 Like

Hello.

I believe that the problem is you’re manually trying to stop the function afterwards.

I see that your animation isn’t looped, and it will stop itself after it plays.

Please try that first, and if it helps you, you’re welcome. Otherwise, you can mention me and I’ll be back to check your code again.

Have a good one.

Wait try holding the original C0 of root in a variable then after the animation set that motor6d back to the original

image

the problem by not stopping the animation is that it slides back into the original position which looks trully bad

the C0 is the exact same after the animation is played

animationtracks have a .Stopped function, will run if the animation stopped

it still does this
its originally what i used but changed

I dont think youve checked because I just manipulated the RootPoint position on purpose and this is what happened

here is a video to show you it didnt change

1 Like

Have you tried not anchoring the humanoidRootPart and instead just using autoRotate and body movers? in the past I found that anchoring the humanoidRootPart caused that weird movement error your having, although It might have just been some weird code I had.