I want to stop this sprinting animation while I am jumping or falling but it does not seem to work. Here is code where I want it to check for the state and stop the script...
while true do
wait()
if Enum.HumanoidStateType.Jumping or Enum.HumanoidStateType.Freefall then
sprintAnim:Stop()
end
end
Not sure if this is a mistake or another piece of code in my local script is preventing it on working. Please help and explain I am new to scripting and still learning. Thanks :) Code for sprinting
-- Sprint Key Pressed
userInputService.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.LeftShift then
if currentStamina >= staminaCost and character.Humanoid.MoveDirection.Magnitude > 0 then
character.Humanoid.WalkSpeed = sprintSpeed
sprintAnim:Play()
end
end
end)

2 comments
Thank you, this worked!
Np!