Animation not restarting

When i play the animation the first time it works but if its idle then it doesnt get out of the stance, if its core then it wont play again once i play the animation again. Heres the script (i cut out all the unecessary parts.

local rs = game.ReplicatedStorage
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://7329007379"
local pressed = false
rs.Charging.OnServerEvent:Connect(function(player, value)
	 pressed = true
		local char = player.Character
	local track = char:WaitForChild("Humanoid"):LoadAnimation(animation)
		if value == "IsCharging" then
			track.Looped = true
			track:Play()
			
			char.Humanoid.WalkSpeed = 0
			char.Humanoid.JumpPower = 0
			char.HumanoidRootPart.Anchored = true
		
			
		elseif value == "IsNotCharging" then
			char.Humanoid.WalkSpeed = 16
			char.Humanoid.JumpPower = 50
			char.HumanoidRootPart.Anchored = false
			pressed = false
			track.Looped = false
			track:Stop()
		end
	end
end)

Try using the animation editor to loop it instead of using a script.

It didnt work have any other ideas?