Help with Humanoid.Running and Animations?

Hello. So I’ve been working on an AI script and lastly all I need is an animation part that detects when the humanoid moves. The way I have it set up is by changing the walkspeed when detecting a player, this will make the .Running function play the ‘runAny’. If the walkspeed is not 25 and greater than 0 then it plays the moveAny. This works however it stutters and plays a split second of the running animation and then constantly restarts. The weird part is that this works fine testing in studio but testing in the actual game, it stutters. I’ve tried many different versions of this but they all have the same outcome.

npc.Creature.Running:Connect(function(speed)
	if speed <= math.round(speed) and moveAny.IsPlaying == false then
		moveAny:Play()
		if runAny.IsPlaying then
			runAny:Stop()
		end
		if not footstepSound.IsPlaying then
			footstepSound.PlaybackSpeed = 1.3
			footstepSound:Play()
		end
	elseif speed > math.round(speed) and runAny.IsPlaying == false then
		runAny:Play()
		if moveAny.IsPlaying then
			moveAny:Stop()
		end
		if not footstepSound.IsPlaying then
			footstepSound.PlaybackSpeed = 2
			footstepSound:Play()
		end
	elseif speed <= 0 then
		runAny:Stop()
		moveAny:Stop()
		footstepSound:Stop()
	end
end)
1 Like

Try maybe reuploading it to the game again or “save to Roblox as”

Try maybe replacing your script with the following:

npc.Creature.Running:Connect(function(speed)
	if speed <= math.round(speed) and moveAny.IsPlaying == false then
		runAny:Stop()
		moveAny:Play()
		if not footstepSound.IsPlaying then
			footstepSound.PlaybackSpeed = 1.3
			footstepSound:Play()
		end
	elseif speed > math.round(speed) and runAny.IsPlaying == false then
		moveAny:Stop()
		runAny:Play()
		if not footstepSound.IsPlaying then
			footstepSound.PlaybackSpeed = 2
			footstepSound:Play()
		end
	elseif speed <= 0 then
		runAny:Stop()
		moveAny:Stop()
		footstepSound:Stop()
	end
end)

Nope, same stuttering seems to happen.

I tried this as I too thought the game wasn’t properly uploading but it doesn’t seem to be that

1 Like