How to check if player moved?

YES, I AM WELL AWARE MOVEDIRECTION EXISTS

Now, on to the question.

How can I check if a Player has moved? Movedirection doesn’t work for me as I constantly have to check if player has moved. Is there a more simple function like Humanoid.Moved?

I have also tried :GetAttributeChangedSignal(), and it did not work.

1 Like

You could run a loop that does some basic math, and uses the .Magnitude thing to check if they moved

1 Like

I’m going to run it on multiple different scripts, it would be draining server resources. I would prefer not to. Is there a alternative option?

1 Like

Try this:

local Players = game:GetService("Players")
local player = Players.LocalPlayer

local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")

humanoid:GetPropertyChangedSignal("MoveDirection"):Connect(function()
	if humanoid.MoveDirection.Magnitude > 0 then
		--// Your code here
	end
end)
1 Like

Thank you, I think I did GetAttributeChangedSignal instead of GetPropertyChangedSignal

1 Like

That is a simple mistake. Happens to the best of us.

1 Like