Sitting Animation No Longer Working After Running Tool Animation

Hey! I’m currently working on a game with tool animations, but whenever I use the animation it completely destroys my ability to sit. Here’s the script and a video:

local tool = script.Parent
local anim = Instance.new("Animation")
anim.AnimationId = 'https://www.roblox.com/Assest?ID=16565052373'
local track

tool.Equipped:Connect(function()
	track = script.Parent.Parent.Humanoid:LoadAnimation(anim) 
	track.Priority = Enum.AnimationPriority.Action
	track:Play()

end)

tool.Unequipped:Connect(function()
	if track then
		track:Stop()
	end
end)

Video of what’s happening:

Please let me know if there’s a line of script I can insert to prevent this. Thank you!

Based on your video: this is an issue with the animation itself rather than an issue relating to your script - though, I would note you should probably try to be a bit safer with your the script.Parent.Parent.Humanoid:LoadAnimation(anim) line – hint: what if the parent(s) don’t exist, or the humanoid doesn’t exist? It will throw an error

Animation issues

When you first equip the tool at 00:02 you will notice that your legs immediately move inwards and remain straight, even when walking at 00:04 - 00:06.

The reason your legs aren’t moving, which is the same reason you don’t perform the sit animation, is that you’ve applied keyframes to the legs somewhere in the animation; and since your animation is being played with the Priority of Enum.AnimationPriority.Action: your legs won’t move because the keyframes from the “Sit” and “Walk” animations are played at Enum.AnimationPriority.Movement (though “Sit” may actually have a higher/lower priority, can’t remember its exactly value)

So, to fix that:

  • Open your animation in the editor
  • Remove the keyframes for the legs/feet
  • Publish the animation again