Weapons Don't Play Intended Idle Animation

Hello developers, I am a novice attempting to make a system where a weapon that is picked up will play a custom idle animation, and when it is unequipped it will stop that animation.

Currently, when the tool is picked up the default Roblox idle animation will play (with the flat outstretched arm), and when the tool is unequipped the desired idle animation will play. This is basically the opposite of my intention.

I have searched through various posts on this website and have tried different scripts and they either don’t work at all or play the desired idle animation once and fail to resume playing it when the tool ir re-equipped.

Here are my two local scripts:

local hum = game.Workspace[game.Players.LocalPlayer.Name]:FindFirstChild("Humanoid")
local idle = hum:LoadAnimation(script.Idle)
script.Parent.Equipped:Connect(function()
	idle:Play()
	script.Parent.Unidler.Disabled = false
	script.Parent.Idler.Disabled = true
end)
local hum = game.Workspace[game.Players.LocalPlayer.Name]:FindFirstChild("Humanoid")
local idle = hum:LoadAnimation(script.Idle)
script.Parent.Unequipped:Connect(function()
	idle:Stop()
	script.Parent.Idler.Disabled = false
	script.Parent.Unidler.Disabled = true
end)

So basically you are trying to override the Roblox animation for holding a tool?

https://developer.roblox.com/en-us/api-reference/event/Player/Idled

You should use the Idled event to detect when a player is idle, then play the animation.