Sprint Animation not Playing

Hey there, I want to make it so when players press Shift they can sprint with a sprinting animation.

The problem is when playing and pressing Shift it makes players faster but does not do the animation and the Output does not provide and errors.

The LocalScript is located inside StarterCharacterScripts

The Script:

In Game:

Output:
image

The Scripts Code:

local UserInputService = game:GetService("UserInputService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer

UserInputService.InputBegan:Connect(function(input, gameProccesed)
	if gameProccesed then
		return
	else
		if input.KeyCode == Enum.KeyCode.LeftShift then
			humanoid = player.Character:WaitForChild("Humanoid")
			humanoid.WalkSpeed = 26
			player.Character.Animate.run.RunAnim.AnimationId = "rbxassetid://8552977429" --RunAnimation
		end
	end
end)

UserInputService.InputEnded:Connect(function(input, gameProccesed)
	if gameProccesed then
		return
	else
		if input.KeyCode == Enum.KeyCode.LeftShift then
			humanoid.WalkSpeed = 16
			player.Character.Animate.run.RunAnim.AnimationId = "rbxassetid://8552975446" --WalkAnimation
		end
	end
end)

I have looked a few places and couldn’t find a working soloution, So i came here.

The animation wont update until you stop walking, and if you start walking again while holding shift then it will play (this will reset every time you let go of shift). There is probably a better way to do this but you could make a separate animation track with the animation’s priority “Action” and play/stop it when ever you start/stop running.

Thanks for your help!

1 Like

Is the original walk animation Action or Movement? (Not the RunAnim.)