-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSprintR.lua
37 lines (29 loc) · 947 Bytes
/
SprintR.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
--[[ Set the file here:
StarterPlayer/StarterPlayerScripts ]]--
local userInput = game:GetService('UserInputService')
local Players = game:GetService('Players')
local sprintSpeed = 30
local walkSpeed = 16
local player = Players.LocalPlayer
local function beginSprint (input, gameProcessed)
if not gameProcessed then
if input.UserInputType == Enum.UserInputType.Keyboard then
local keycode = input.KeyCode
if keycode == Enum.KeyCode.RightAlt then
player.Character.Humanoid.WalkSpeed = sprintSpeed
end
end
end
end
local function endSprint (input, gameProcessed)
if not gameProcessed then
if input.UserInputType == Enum.UserInputType.Keyboard then
local keycode = input.KeyCode
if keycode == Enum.KeyCode.RightAlt then
player.Character.Humanoid.WalkSpeed = walkSpeed
end
end
end
end
userInput.InputBegan:Connect(beginSprint)
userInput.InputEnded:Connect(endSprint)