Hello, I've been making some crouch and sprint scripts but I just realised that my sprint script doesnt work:
local player = game.Players.LocalPlayer local mouse = player:GetMouse() mouse.KeyDown:connect(function(key) if key == "leftshift" then --my sprint script end end)
When i change "leftshift" to key like "v" it does work
Use UserInputService.
local UserInputService = game:GetService("UserInputService") local function onInputBegan(input, _gameProcessed) if input.UserInputType == Enum.UserInputType.Keyboard then if input.KeyCode == Enum.KeyCode.LeftShift then print("The left shift key has been pressed!") end end end UserInputService.InputBegan:Connect(onInputBegan)