Using Humanoid:GetPropertyChangesSignal(“MoveDirection”) also doesn’t work because it only fires when the “MoveDirection” changes… it seems like my only option is to use a Heartbeat connection or Bind to Renderstepped in which I would like to avoid if possible
Is there a better way to detect if a player is moving? I would prefer not to check every Frame (60 times per second) that is just too much.
Use case:
Goal: I want an animation that is currently playing to stop if the player moves
Current issue: If a player is already moving and then play that animation it will not be canceled
I was looking into using the default PlayerControl script but I couldn’t find any “signal” for detecting if the player is moving or not.
You could check Humanoid.MoveDirection Humanoid.MoveDirection -- Returns 0,0,0 if not moving according to user inputs , if its not 0,0,0 it indicates that the player is moving
MoveDirection should work for this, back when I first started scripting a wrote a scuff script to detect when they start moving.
coroutine.wrap(function()
while wait() do
if humanoid.MoveDirection.X > 0 or humanoid.MoveDirection.X < 0 or humanoid.MoveDirection.Z > 0 or humanoid.MoveDirection.Z < 0 or humanoid.MoveDirection.Y > 0 or humanoid.MoveDirection.Y < 0 then -- as you can see it's scuff since I didn't know what I was doing much back then
-- Stop animation
end
end
end)()