What are better ways to manage custom animations?

Although this code does technically work, I find myself wanting a better way to do this. Are there better ways to go about having custom animations when a tool is equipped, and if so what are they? (I appreciate all help whether it’s related to scripting or not. I have very little experience in the way of animating.)

Currently I use the following script in the tool to do it:

-- Variables --
local plr = game:GetService("Players").LocalPlayer
local tool = script.Parent
local animate = plr.Character.Animate
local animations = tool.Animations

-- Functions --
-- Change to new animations --
tool.Equipped:Connect(function()
	animate.idle.Animation1.AnimationId = animations.Idle.AnimationId
	animate.idle.Animation2.AnimationId = animations.Idle.AnimationId
	animate.walk.WalkAnim.AnimationId = animations.Walk.AnimationId
end)

-- Revert to default animations --
tool.Unequipped:Connect(function()
	animate.idle.Animation1.AnimationId = "rbxassetid://180435571"
	animate.idle.Animation2.AnimationId = "rbxassetid://180435792"
	animate.walk.WalkAnim.AnimationId = "rbxassetid://180426354"
end)

I find that there are several issues with this though, such as delayed animation switching times, it possibly not even being on the server right (probably because this is in a local script, so I can try solving this myself- I haven’t tried yet tbh.), and it would become a hassle to update and add new animations any time I did.

I want the script to also work with other tools as well and all I’d have to do is update the animation IDs according to the tool.

Here is a video of the issues I’m talking about:

dont change the animationid u should start playing a new animation track with those new animations when the tool gets unequipped/stop when it gets unequipped (assuming ur using defualt roblox animations for everything else) changing the animationid is probably a bad idea

Make your current animation have a higher priority than core, and add an “animation” instance to somewhere where the player can access it, Create a variable etc. Then, when the player equips the tool just play the animation and stop playing it when the player unequips

I know that’s a thing and was how I originally intended to do that but wouldn’t that only work for the idle animation? How could I script it so it’d play the walking animation when their walking or the jumping animation when they’re jumping?

Using the animate script is not how you should do it. You must make the animations in the tool and MAKE SURE to load the animations and play them depending on the humanoid’s state, OTHERWISE IT WON’T WORK!!!