Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Shift to sprint advanced
- -------------------------------------------------------------------------------------
- local player = game.Players.LocalPlayer
- local character = player.Character or player.CharacterAdded:Wait()
- local humanoid = character:WaitForChild("Humanoid")
- local normalWalkSpeed = 16
- local sprintWalkSpeed = 32
- -- Function to set the walkspeed
- local function setWalkSpeed(speed)
- humanoid.WalkSpeed = speed
- end
- -- Detect when the Shift key is pressed
- game:GetService("UserInputService").InputBegan:Connect(function(input)
- if input.KeyCode == Enum.KeyCode.LeftShift or input.KeyCode == Enum.KeyCode.RightShift then
- setWalkSpeed(sprintWalkSpeed)
- end
- end)
- -- Detect when the Shift key is released
- game:GetService("UserInputService").InputEnded:Connect(function(input)
- if input.KeyCode == Enum.KeyCode.LeftShift or input.KeyCode == Enum.KeyCode.RightShift then
- setWalkSpeed(normalWalkSpeed)
- end
- end)
- -------------------------------------------------------------------------------------
- -poke
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement