I keep getting errors whenever I run this This is a sprinting mechanic btw
local UserInputService = game:GetService("UserInputService") local player = game.Players.LocalPlayer`` local char = player.Character KeyPressed = false UserInputService.InputBegan:Connect(function(input,gameProcessedEvent) if input.Keycode == Enum.KeyCode.LeftShift then KeyPressed = true end end) UserInputService.InputEnded:Connect(function(input,gameProcessedEvent) if input.Keycode == Enum.KeyCode.LeftShift then KeyPressed = false end end) if KeyPressed == true then char.Humanoid.Walkspeed = 32 else char.Humanoid.Walkspeed = 16 end
Errors: Players.Flasker917.PlayerScripts.LocalScript:21: attempt to index nil with 'Humanoid' Keycode is not a valid member of InputObject "InputObject"