I had issues with scripting sprint system.
help is appreciated.
here is the video:
Video: https://www.youtube.com/watch?v=ismbSuCL7qg
I had issues with scripting sprint system.
help is appreciated.
here is the video:
Video: https://www.youtube.com/watch?v=ismbSuCL7qg
It may be becuase the animation priority is at it’s lowest. Try setting the animations priority to Action and see if it works.
The animation priority is already set to Action? What do you mean?
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
I’ma take a look, i got something to do.
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
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!)
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, give me a second. I will fix it.
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