I'm trying to play an animation every time a player is running, in a limited time. I've already tried to use something like this
local humanoid = script.Parent:WaitForChild("Humanoid")
local anim = script.Animation
local animTrack = humanoid:LoadAnimation(anim)
humanoid.Running:Connect(function(speed)
if speed > 0 then
animTrack:Play()
else
animTrack:Stop()
end
end)
in StarterCharacterScripts, and also altered it a bit to use in StarterPlayerScripts, but it didn't work. What's wrong?

3 comments
You're attempting to interfere with a player's input to run. That's the problem.
But how is it interfering?
If they input any key in the WASD or arrow key sequence, they can easily bust out of the animation. In order to fix this, you have to keybind the movement keys to different keys.