How to detect if a player is moving

How to detect if the player is moving. I want to create a game that a player can only move when the light is green and if it’s red then if you move ur out

1 Like

player.Character.Humanoid.MoveDirection.Magnitude > 0

This will only be true if the player is moving

You can either do this

humanoid:GetPropertyChangedSignal("MoveDirection"):Connect(function()
   if humanoid.MoveDirection.Magnitude > 0 then
         print("is moving")
   else print("is not moving")
end)

Else you can use this event
https://developer.roblox.com/en-us/api-reference/event/Humanoid/Running

1 Like
if player.humanoid:GetState(Enum.HumanoidState.Running) then
---code
end

Obviously this isn’t the correct way to spell out the words but that’s how I remember it.