Animation doesnt stop

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Gun animation

  2. What is the issue? storing the animationtrack in an array and then once unequibbed we use :stop() and :destroy() does not disable or delete the animation

  3. What solutions have you tried so far? I’ve tryed printing what animation’s playing, and after the :stop() and :destroy, It still prints and persists

script.Parent.Equipped:Connect(function()
	game.ContextActionService:BindAction("RELOAD", reload, true, Enum.KeyCode.R)
	table.insert(load,char:WaitForChild("Humanoid").Animator:LoadAnimation(anim))
	table.insert(load,char:WaitForChild("Humanoid").Animator:LoadAnimation(animR))
	table.insert(load,char:WaitForChild("Humanoid").Animator:LoadAnimation(animS))
	load[1]:Play()
end)
script.Parent.Unequipped:Connect(function()
	char = plr.Character
	game.ContextActionService:UnbindAction("RELOAD")
	for i,v in pairs(load) do
		print(v)
		v:Stop()
		v:Destroy()
		print(char.Humanoid:GetPlayingAnimationTracks())
		print("DESTROYED")
	end
	print(char.Humanoid:GetPlayingAnimationTracks())
	load = {}
end)

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

It’s probably because of the fade time I would guess.

After calling AnimationTrack:Stop, there is a default fade time of 0.1 seconds where the animation fades out and is still playing. I would try using :Stop(0) instead to make sure there is no fade time.

It’s weird Destroy doesn’t stop with zero fade time, but I guess Roblox decided not to add that. Basically what’s happening then is the AnimationTrack is parented to nil but not cleaned up so it just keeps on playing (because AnimationTracks don’t need to be parented to instances to work).

1 Like