Enhanced Sprint System

This is an improvement upon the last post I made about this.

Features:

  • Slowly builds up and slows down WalkSpeed
  • Gives wider FOV when sprinting (eye-candy)
  • Slightly increases JumpPower
  • Increases the Running animation sound RELATIVE to the current speed

Source: Gist - GitHub: EnhancedSprintSystem.lua

Enjoy!

17 Likes

Cool module and all, probably won’t use it but can be useful for new scripters.
A tip for your code, don’t create the tweens inside the event. Create them outside and make them a variable and play them inside the event. You can also tween two different properties in one tween because its a table, so the different tweens for the jumppower/walkspeed isn’t needed. Also remember to create variables for Humanoid since your referencing it quite often. So it would be good to create a variable for that, would make your code cleaner. But good job on your script!

2 Likes

As stated above, nice module.
Another tip I have for you would to store the character as a local variable, as your referencing it 4 times when the shift key is pressed. Another piece of advice would be to pre-define the TweenInfo, so you can more easily edit it. Finally, I would advise you to add the gameProcessed check on the UserInputService call to check if the player isn’t chatting, or editing a text box. My final recommendation would be to use the :Destroy() method on tweens once your not using them anymore, to prevent memory leaks.

1 Like

It is meant to be beginner-friendly, which is why I didn’t include multiple properties in the tween. I also wrote it in like 30 seconds, so it’s not perfectly microoptimized.

It works in R15, but I don’t know about R6. Are you sure you added it correctly?

There was a very small and obvious-to-fix typo in the gist, but I fixed it. It should have generated an error for Players being an undefined variable.

No no no, do NOT use this. This is terrible(no offense). This will fire anytime they press shift, it’ll fire, even if they are chatting. Looking at the source code, you use user input service, but dont use any if statements to check if the user is typing in the chat or not. Another point, this will not work on mobile(or any device for that matter). Only PC, you are essentially cutting off 55% of roblox’s users from using this. This is only counting mobile, not xbox or any of that. Consider using context action service instead. Its better and allows you to add mobile support, xbox support etc.

3 Likes

Even though it is for beginners, you should still make the code optimized. If the code contains memory leaks, it will teach beginners bad practices.

Forgetting to use the gameProcessed event and being pc restricted =/= terrible

1 Like