Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I detect when a player walks?

2 answers

The easiest way to do this is with the Running event of the humanoid.

It'll look something like this:

local MovingCharacter = function(speed)
	if speed > 2 then --This makes it so they're not just moving from something else or by accident.
		--Code
	end 
end

workspace:FindFirstChild(--[[Name of the player]]--).Humanoid.Running:Connect(MovingCharacter)

What the code is doing is it detects if the characters running. Then to check if the character is just being moved or if it's moving at full speed. Just a tiny threshold.

Tomstah is correct, but I just felt that there was a more efficient way of doing it when checking players.

local MovingCharacter = function(speed)
    if speed > 2 then --This makes it so they're not just moving from something else or by accident.
        --Code
    end 
end

for _, player in pairs (game.Players:GetPlayers()) do
workspace:FindFirstChild(player).Humanoid.Running:Connect(MovingCharacter)
end

This discussion is preserved as it was. New answers, comments, and votes are closed.