Answers for "roblox sprint"

0

roblox sprint

-- This script must be in StarterCharacter
local UserInputService = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local Character = player.Character or player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
-- input is the Key that the player presses,
-- gameProcessedEvent is true if the player is chatting, sitting or doing core things
	if (gameProcessedEvent == false) and (input.KeyCode == Enum.KeyCode.LeftShift then
		Humanoid.WalkSpeed += 6
    end
end)

UserInputService.InputEnded:Connect(function(input, gpe)
	if (gpe == false) and input.KeyCode == Enum.KeyCode.LeftShift then
    	Humanoid.WalkSpeed -= 6
	end
end)
Posted by: Guest on April-21-2022

Browse Popular Code Answers by Language