Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local player = game.Players.LocalPlayer
- local character = player.Character
- local UserInputService = game:GetService("UserInputService")
- local stamina = 100
- local running = false
- stamina = math.clamp(stamina,0,100)
- UserInputService.InputBegan:Connect(function(input)
- if input.KeyCode == Enum.KeyCode.LeftShift then
- running = true
- character.Humanoid.WalkSpeed = 32
- while stamina > 0 and running do
- stamina = stamina - 1
- script.Parent:TweenSize(UDim2.new(stamina / 100,0,1,0), "Out","Linear", 0)
- wait()
- if stamina == 0 then
- character.Humanoid.WalkSpeed = 16
- end
- end
- end
- end)
- UserInputService.InputEnded:Connect(function(input)
- if input.KeyCode == Enum.KeyCode.LeftShift then
- running = false
- character.Humanoid.WalkSpeed = 16
- while stamina < 100 and not running do
- stamina = stamina + 1
- script.Parent:TweenSize(UDim2.new(stamina / 100,0,1,0), "Out","Linear", 0)
- wait()
- if stamina == 0 then
- character.Humanoid.WalkSpeed = 16
- end
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement