Trouble with humanoids animation

Hello developers!
I’ve been trying to make a tower defense game for the past few days, but i’ve encountered an issue when making the enemies animations: Only the first enemy to appear doesn’t get its animation played. However, every other enemy is working without an issue, i am also getting no errors. Also, the animation does play in Studio, but not when i test on the Roblox app. What could be causing it?

Script:

function setAnimation(object, animName)
	local humanoid = object:WaitForChild("Humanoid")
	local animationsFolder = object:WaitForChild("Animations")

	if humanoid and animationsFolder then
		local animationObject = animationsFolder:WaitForChild(animName)

		if animationObject then
			local animator = humanoid:FindFirstChild("Animator")
			local animationTrack = animator:LoadAnimation(animationObject)
			return animationTrack
		end
	end
end

function playAnimation(object, animName)
	local animationTrack = setAnimation(object, animName)

	if animationTrack then
		animationTrack:Play()
	else
		warn("Animation track does not exist")
		return
	end
end

	workspace.Mobs.ChildAdded:Connect(function(zombie)
				playAnimation(zombie, "Walk")
			end)

If it helps, the script is a module script required by a server script.

I think the animation is failing to load. If it loads properly then it should play.