IsKeyDown not returning true

local runService = game:GetService("RunService")
local userInputService = game:GetService("UserInputService")
local sprinting = userInputService:IsKeyDown(Enum.KeyCode.LeftShift) or userInputService:IsKeyDown(Enum.KeyCode.RightShift)

runService.Heartbeat:Connect(function(step)
    print("Sprinting Bool: ",sprinting)
end)

Does anyone know if this is a bug or just me? For some odd reason, sprinting doesn’t evaluate to a true if I hold it down. On a mac.

I appreciate your time.

You need to update the sprinting variable when ever you want to run a condition on it, as it’ll only return the value once and you’re left with that value until you update it/run it again. Hope this helps :slight_smile:

4 Likes

Confirmed. Lost my sanity. Silly mistake. Thanks !!

1 Like