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)
Your sprinting is good but you're not checking the players humanoid state you're only checking humanoidstatetype which errors you!
while wait() do if character.Humanoid:GetState() == Enum.HumanoidStateType.Jumping or character.Humanoid:GetState() == Enum.HumanoidStateType.Freefall then sprintAnim:Stop() end end
hey you! have you ever heard of enes? if you are in trouble, better call enes!