Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Place this script inside a LocalScript in StarterPlayerScripts
- local player = game.Players.LocalPlayer
- local character = player.Character or player.CharacterAdded:Wait()
- local humanoid = character:WaitForChild("Humanoid")
- local userInputService = game:GetService("UserInputService")
- local isSprinting = false
- local walkSpeed = humanoid.WalkSpeed
- local sprintSpeed = 2 * walkSpeed -- You can adjust the sprint speed multiplier here
- local function onKeyPress(input)
- if input.KeyCode == Enum.KeyCode.LeftShift then
- isSprinting = true
- humanoid.WalkSpeed = sprintSpeed
- end
- end
- local function onKeyRelease(input)
- if input.KeyCode == Enum.KeyCode.LeftShift then
- isSprinting = false
- humanoid.WalkSpeed = walkSpeed
- end
- end
- userInputService.InputBegan:Connect(onKeyPress)
- userInputService.InputEnded:Connect(onKeyRelease)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement