Idle animation not playing instantly when changing through script

Hello, I have a script that changes the idle/walk animations when the tool (gun) is equipped
For some reason, the idle animation doesn’t change when the tool is equipped, but it changes once I stop moving again.
Here’s what I mean:
https://gyazo.com/df306ca069d5234e4a2499ee9f867a47

Script:

local glock = script.Parent

glock.Equipped:Connect(function()
	game.Players.LocalPlayer.Character.Animate.idle.Animation1.AnimationId = "rbxassetid://9001001657"
	game.Players.LocalPlayer.Character.Animate.idle.Animation2.AnimationId = "rbxassetid://9001001657"
end)
glock.Unequipped:Connect(function()
	game.Players.LocalPlayer.Character.Animate.idle.Animation1.AnimationId = "rbxassetid://8302051399" --default id
	game.Players.LocalPlayer.Character.Animate.idle.Animation2.AnimationId = "rbxassetid://8302051399"
end)

Any help on how to fix this?

Is that your only script connected to the issue?

If this doesn’t work you can try deleting the old animation script and replacing it with a new one (with the correct animation id’s)

…why are you playing an animation like this? There’s no practical reason for you to change the animation id, so Roblox doesn’t check if it changed. Just make a new animation and use :Play() and :Stop() on it, and if that doesn’t work, remember to make sure it’s priority is “Action”.

When I do that, it overlaps with the walk and jump animations. I changed the priority of the animation to idle and it still overlaps.

There’s that and the animate script in startercharacterscripts which I use to change the walk and regular idle animation. They’re set to their respective priorities