Advertisement
HAHOOS

Sprint | Roblox Studio

Sep 18th, 2021
1,016
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.84 KB | None | 0 0
  1. local inputService = game:GetService("UserInputService")
  2. --Settings(can be changed)
  3. local normalWalkSpeed = 16
  4. local sprintWalkSpeed = 32
  5. local key = Enum.KeyCode.LeftShift
  6.  
  7. inputService.InputBegan:Connect(function(input)
  8.     if input.UserInputType == Enum.UserInputType.Keyboard then
  9.         local keycode = input.KeyCode
  10.         if keycode == key then
  11.             local character = game.Players.LocalPlayer.Character
  12.             local humanoid = character:WaitForChild("Humanoid")
  13.             humanoid.WalkSpeed = sprintWalkSpeed
  14.         end
  15.     end
  16. end)
  17.  
  18. inputService.InputEnded:Connect(function(input)
  19.     if input.UserInputType == Enum.UserInputType.Keyboard then
  20.         local keycode = input.KeyCode
  21.         if keycode == key then
  22.             local character = game.Players.LocalPlayer.Character
  23.             local humanoid = character:WaitForChild("Humanoid")
  24.             humanoid.WalkSpeed = normalWalkSpeed
  25.         end
  26.     end
  27. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement