(CLOSED) Got problem with sprint

I have issue with making sprint.

Issue: When my character jumps and climbs while playing sprint animation it plays orginal walking animation and i want to fix this bug as soon as possible.

Video: - YouTube

The sprinting script is in gun scripts so I can’t give scripts right now.

Here is Discord, DM me please if you found the solution: notbad#1133

It may be becuase the animation priority is at it’s lowest. Try setting the animations priority to Action and see if it works.

It’s already in Action. I set animation priority

Well it’s very hard to tell without any code but if I understood correctly then you want to play the sprint animation whenever the player lands?

Well the Humanoid has an event called StateChanged and you’d want to detect whenever the state type is Landed.

Now you’d want to check whenever the player lands if the player is pressing the shift key by using UserInputService:IsKeyDown()

And if so then play the animation

1 Like

Give me a second let me do it right now.

The code is here:

function OnSprinting()
if not Reloading and not SprintCooldown and not Overheated and AimDown == false and ActuallyEquipped and Enabled and not Inspecting and not Switching and Module.SprintAnimationEnabled and Humanoid.MoveDirection.Magnitude > 0 then
Sprinting = true
Humanoid.WalkSpeed = Humanoid.WalkSpeed + Module.SprintWalkSpeedAddition
if SprintAnim then SprintAnim:Play(nil,nil,Module.SprintAnimationSpeed) end
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
game.Players.LocalPlayer.Character.Humanoid.JumpPower = 50
end
end

not gonna lie, this is hard to read… you may wanna re-write that code buddy

1 Like

So that’s the function for actually making the player sprint, all you need to do is call it whenever the player lands or when he’s holding shift (depending on when you want to call it!)

1 Like

also, i’d recommend using (rootpart.CFrame:PointToObjectSpace(rootpart.Velocity).Z*-1) to get the true speed of your character’s movedirection, and doing a ratio of the speed of your character to that

You’re right though give me a second. I will fix it.

1 Like

Ok thanks. Have a good day. Ok i gotta go

You know what, here’s a way to tell if you are sprinting

function isSprinting()
local speed = HRP.CFrame:PointToObjectSpace().Z*-1


return speed >= runspeed-1
end