RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"Create a sprinting function to the player"
-- local script local player = game:GetService("Players").LocalPlayer local character = player.Character or player.CharacterAdded:Wait() local humanoid = character:WaitForChild("Humanoid") local sprintSpeed = 50 local normalSpeed = 16 local sprinting = false local function toggleSprint() if sprinting then sprinting = false humanoid.WalkSpeed = normalSpeed else sprinting = true humanoid.WalkSpeed = sprintSpeed end end local function onKeyPress(input, gameProcessed) if gameProcessed then return end if input.KeyCode == Enum.KeyCode.LeftShift or input.KeyCode == Enum.KeyCode.RightShift then toggleSprint() end end game:GetService("UserInputService").InputBegan:Connect(onKeyPress)