Advertisement
Tacidus

Sprint Stamina

Dec 17th, 2020
7,854
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.43 KB | None | 0 0
  1. --// MADE BY TACIDUSYT \\--
  2.  
  3. --// VARIABLE \\--
  4.  
  5. local UIS = game:GetService('UserInputService')
  6. local Bar = script.Parent:WaitForChild('Sprint'):WaitForChild('Bar')
  7. local player = game.Players.LocalPlayer
  8. local NormalWalkSpeed = 16
  9. local NewWalkSpeed = 25
  10. local ii = 10
  11. local running = false
  12. repeat wait() until game.Players.LocalPlayer.Character
  13. local character = player.Character
  14.  
  15. --// FUNCTIONS \\--
  16.  
  17. UIS.InputBegan:connect(function(key, gameProcessed)
  18.     if key.KeyCode == Enum.KeyCode.LeftShift and gameProcessed == false then
  19.         character.Humanoid.WalkSpeed = NewWalkSpeed
  20.         running = true
  21.         while ii > 0 and running do
  22.             ii = ii - .03
  23.             Bar:TweenSize(UDim2.new(ii / 10, 0, 1, 0), 'Out', 'Quint', .1, true)
  24.             --Bar.BackgroundColor3 = Bar.BackgroundColor3:lerp(Color3.fromRGB(255, 42, 42), 0.001)
  25.             wait()
  26.             if ii <= 0 then
  27.                 character.Humanoid.WalkSpeed = NormalWalkSpeed
  28.             end
  29.         end
  30.     end
  31. end)
  32.  
  33. UIS.InputEnded:connect(function(key, gameProcessed)
  34.     if key.KeyCode == Enum.KeyCode.LeftShift and gameProcessed == false then
  35.         character.Humanoid.WalkSpeed = NormalWalkSpeed
  36.         running = false
  37.         while ii < 10 and not running do
  38.             ii = ii + .03
  39.             Bar:TweenSize(UDim2.new(ii / 10, 0, 1, 0), 'Out', 'Quint', .1, true)
  40.             --Bar.BackgroundColor3 = Bar.BackgroundColor3:lerp(Color3.fromRGB(255, 166, 11), 0.001)
  41.             wait()
  42.             if ii <= 0 then
  43.                 character.Humanoid.WalkSpeed = NormalWalkSpeed
  44.             end
  45.         end
  46.     end
  47. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement