roblox shift to run script code example
Example: how to make a shift to sprint roblox
local UIS = game:GetService("UserInputService")
local Player = game.Players.LocalPlayer
local Character = script.Parent -- Put a LocalScript into StartPlayer > StarterCharacterScript
local Humanoid = Character:WaitForChild("Humanoid")
UIS.InputBegan:Connect(function(Key)
if Key.KeyCode == Enum.KeyCode.LeftShift or Enum.KeyCode.RightShift then
local Running = true
Humanoid.WalkSpeed = 32
end
end
UIS.InputEnded:Connect(function(Key)
if Key.KeyCode == Enum.KeyCode.LeftShift or Enum.KeyCode.RightShift then
local Running = false
Humanoid.WalkSpeed = 16
end
end