Advertisement
OnFireRobloxScriptin

Shift to Sprint Script (2023)

Aug 28th, 2023 (edited)
1,395
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.04 KB | None | 0 0
  1. local uis = game:GetService("UserInputService") --Gets the UserInputService from the game
  2. local humanoid = script.Parent:WaitForChild("Humanoid") --Gets the Player's Humanoid
  3. local db = true --debounce
  4.  
  5. --//Press shift
  6. uis.InputBegan:Connect(function(input) --When the player presses a key
  7.     if db then --If debounce is true then
  8.         if input.KeyCode == Enum.KeyCode.LeftShift then --If the key is the left shift then
  9.             humanoid.WalkSpeed = 32 --Sets the Humanoid Speed to 32 (Change 32 to how fast you want)
  10.             db = false --Sets debounce to false
  11.         end
  12.     end
  13. end)
  14.  
  15. --//Release shift
  16. uis.InputEnded:Connect(function(input) --When the player releases a key
  17.     if not db then --If debounce is false then
  18.         if input.KeyCode == Enum.KeyCode.LeftShift then --If the key is the left shift then
  19.             humanoid.WalkSpeed = 16 --Sets the Humanoid Speed to 16 (16 is default)
  20.             db = true --Sets debounce to true
  21.         end
  22.     end
  23. end)
  24.  
  25. --If you also want to change the FOV (Field of View) when your speed increases, watch the full tutorial: https://youtu.be/fqAPQ4BneVM
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement