Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

is there a way to find out if a player is moving?

Asked by 7 years ago

this isnt a request, just wondering if there is a way to do this

2 answers

Log in to vote
2
Answered by
2eggnog 981 Moderation Voter
7 years ago

Use the Humanoid.Running event. This event fires both when the Humanoid starts and stops running, so you need to check the speed to ensure the Humanoid is actually moving.

Taken from the wiki:

game.Workspace.Player.Humanoid.Running:connect(function(speed)
    if speed > 0 then
        print("Player is running")
    else
        print("Player has stopped")
    end
end)
Ad
Log in to vote
1
Answered by
chrono2 189
7 years ago

Actually, yes. Humanoids have a "Running" event that triggers whenever they start moving. You can use that to detect movement, as seen below.

game.Players.LocalPlayer.Character.Humanoid.Running:connect(function()
    print("the player is moving!")
end)

Answer this question