How do you check if a player is running?


I’ve been having troubles with detecting if a player is running or not. I’ve already tried the PlayerBindPress hook, which doesn’t work with +speed. I’ve also tried the KeyPress Hook, which also, does not work with +speed. The only thing that I’ve gotten to work, is:

hook.Add("Think", "SPEEDCHECK", function()
local ply = LocalPlayer()
ply.IsRunning = true
ply.IsRunning = false

This however, does not work properly, because it returns that it’s being pressed and not being pressed at the same time. If this is the only way to do it, how exactly should I use it? I can’t seem to find a good hook to use that in. Thanks!

You meant to use
“if ply:KeyDown(IN_SPEED) then”


That’s exactly it, haha, thanks alot! (I feel dumb now =])

You might want to do checks to see if they’re on the ground or actually moving as well, since this is detecting them holding sprint, not actually running.

yeah I know, I already do have these checks in place, I just didn’t understand why that code wasn’t working, until you made me realise tha tit was “KeyPressed” and not “KeyDown”. Thank though!