This seems to work fine, but I want to know if it is the most optimized way to do so.
--// Services
local repStr = game:GetService'ReplicatedStorage'
--// References
local plr = game.Players.LocalPlayer
repeat wait() until plr.Character
local char = plr.Character
local hum = char:WaitForChild'Humanoid'
local step = repStr:WaitForChild'step'
--// Variables
local timeElapsed
local lastStep = 0
while wait(.13) do
if hum.MoveDirection ~= Vector3.new(0,0,0) then
wait(.13)
local elapsed = tick()-lastStep
lastStep = tick()
if elapsed >= .13 then
step:FireServer()
end
end
end

3 comments
https://www.robloxdev.com/api-reference/event/Humanoid/Running
no you can use HumanoidStateType
Wait! Who deleted my comment???