How can I check every time a player takes one step?

I’ve been trying to figure this out for a little while now and what I want to do is check every time a player takes a step (one stud), I tried searching for a bit but everything I found was unreliable and didn’t check for one stud, thank you for your time.

1 Like

The way I found best is this super cool feature where you basically put events inside of an animation.

So you might have to make your own walking animation or edit the current roblox one and just put an animationevent where the player steps, call it stepped or something

Then in the default animation script where it controls the walking animation you would put something along the lines of:

animationTrack:GetMarkerReachedSignal("stepped"):Connect(function(value)
    footStepSound.Volume = tonumber(value)
    footStepSound:Play()
end)

I recommend checking out this thread for a better explanation

2 Likes
local run = game:GetService("RunService")

local players = game:GetService("Players")
local player = players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local hrp = character:WaitForChild("HumanoidRootPart")
local humanoid = character:WaitForChild("Humanoid")

local oldHrp = hrp.Position

run.RenderStepped:Connect(function()
	local newHrp = hrp.Position
	local distance = (oldHrp - newHrp).Magnitude
	if distance >= 1 and humanoid.MoveDirection.Magnitude > 0 then
		print("1 stud walked!")
		oldHrp = newHrp
	end
end)

Just wrote this, seems pretty accurate from the tests I performed.

4 Likes

Thank you for all your solutions, I am giving @Forummer the solution because it seems to be the most accurate.