Advertisement
ShinjitaroSoul

Deepwoken Style Sprint [Roblox]

Feb 11th, 2023
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.06 KB | Gaming | 0 0
  1. --[[
  2.  
  3. ██████╗ ███████╗███████╗██████╗ ██╗    ██╗ ██████╗ ██╗  ██╗███████╗███╗   ██╗    ████████╗██╗   ██╗██████╗ ███████╗    ███████╗██████╗ ██████╗ ██╗███╗   ██╗████████╗
  4. ██╔══██╗██╔════╝██╔════╝██╔══██╗██║    ██║██╔═══██╗██║ ██╔╝██╔════╝████╗  ██║    ╚══██╔══╝╚██╗ ██╔╝██╔══██╗██╔════╝    ██╔════╝██╔══██╗██╔══██╗██║████╗  ██║╚══██╔══╝
  5. ██║  ██║█████╗  █████╗  ██████╔╝██║ █╗ ██║██║   ██║█████╔╝ █████╗  ██╔██╗ ██║       ██║    ╚████╔╝ ██████╔╝█████╗█████╗███████╗██████╔╝██████╔╝██║██╔██╗ ██║   ██║  
  6. ██║  ██║██╔══╝  ██╔══╝  ██╔═══╝ ██║███╗██║██║   ██║██╔═██╗ ██╔══╝  ██║╚██╗██║       ██║     ╚██╔╝  ██╔═══╝ ██╔══╝╚════╝╚════██║██╔═══╝ ██╔══██╗██║██║╚██╗██║   ██║  
  7. ██████╔╝███████╗███████╗██║     ╚███╔███╔╝╚██████╔╝██║  ██╗███████╗██║ ╚████║       ██║      ██║   ██║     ███████╗    ███████║██║     ██║  ██║██║██║ ╚████║   ██║  
  8. ╚═════╝ ╚══════╝╚══════╝╚═╝      ╚══╝╚══╝  ╚═════╝ ╚═╝  ╚═╝╚══════╝╚═╝  ╚═══╝       ╚═╝      ╚═╝   ╚═╝     ╚══════╝    ╚══════╝╚═╝     ╚═╝  ╚═╝╚═╝╚═╝  ╚═══╝   ╚═╝  
  9.                                                                                                                                                                      
  10. ]]
  11.  
  12. -- Services
  13. local uis = game:GetService("UserInputService")
  14. local runService = game:GetService("RunService")
  15.  
  16. -- Player & Character Variables
  17. local player = game.Players.LocalPlayer
  18. local character = player.Character or player.CharacterAdded:Wait()
  19. local humanoid = character:WaitForChild("Humanoid")
  20.  
  21. -- Sprint Variables
  22. local sprintSpeed = 26
  23. local defaultSpeed = 16
  24. local lastSprint = tick()
  25. local sprinting = false
  26. local sprintKeys = {
  27.     Enum.KeyCode.W,
  28.     Enum.KeyCode.A,
  29.     Enum.KeyCode.S,
  30.     Enum.KeyCode.D,
  31. }
  32.  
  33. local ticks = {
  34.     [Enum.KeyCode.W] = tick(),
  35.     [Enum.KeyCode.A] = tick(),
  36.     [Enum.KeyCode.S] = tick(),
  37.     [Enum.KeyCode.D] = tick()
  38. }
  39.  
  40. -- Sprint Functions
  41. local function SprintHandler(key, gme)
  42.     if gme then return end
  43.  
  44.     if table.find(sprintKeys, key.KeyCode) and not sprinting then
  45.         if tick() - ticks[key.KeyCode] <= 0.2 then
  46.             sprinting = true
  47.             print("sprinting")
  48.             humanoid.WalkSpeed = sprintSpeed
  49.         else
  50.             ticks[key.KeyCode] = tick()
  51.         end
  52.     end
  53. end
  54.  
  55. local function SprintRunService()
  56.     if sprinting then
  57.         local oneDown = false
  58.         for i, v in ipairs(sprintKeys) do
  59.             if uis:IsKeyDown(v) then
  60.                 oneDown = true
  61.             end
  62.         end
  63.  
  64.         if not oneDown then
  65.             sprinting = false
  66.             humanoid.WalkSpeed = defaultSpeed
  67.             print("stopped sprinting")
  68.         end
  69.     end
  70. end
  71.  
  72. -- Sprint Events
  73. uis.InputBegan:Connect(SprintHandler)
  74. runService.RenderStepped:Connect(SprintRunService)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement