Animation not functioning even though it worked earlier

So I was scripting and tested the game and I wondered why it didn’t have animations because it was working earlier I was just asking if anybody knew why and how could I fix it

local function animateMob(object)
	local humanoid = object:WaitForChild("Humanoid")
	local animationsFolder = object:WaitForChild("Animations")

	if humanoid and animationsFolder then
		local walkAnimation = animationsFolder:WaitForChild("Walk")
		if walkAnimation then
			local animator = humanoid:FindFirstChild("Animator") or Instance.new("Animator", humanoid)
			local walkTrack = animator:LoadAnimation(walkAnimation)
			walkTrack:Play()
		end
	else
		warn("No humanoid/animation folder for", object.Name)
	end
end

workspace.Mobs.ChildAdded:Connect(animateMob)

I fixed the error turns out I used FindFirstChild and then used Roblox Studios run command so there was no players so the animations didn’t run at all

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.