Humanoid MoveDirection stays at 0,0,0 despite moving

Hi,

So I’ve run into an issue where the humanoid’s MoveDirection stays at 0,0,0 despite calling MoveTo on it and the character itself is moving.

while true do
	print(humanoid.MoveDirection)
	task.wait()
end

I’m calling :MoveTo on the humanoid on the server but even though it’s moving, the MoveDirection still remains at 0,0,0 so I can’t use this to determine when the humanoid is idle. Is this intended behaviour or am I doing something wrong?
image

It’s also a custom rig.

I know it’s a stupid question, but just for the sake of trouble shooting; is the character moving in multiple directions? MoveDirection describes the unit vector direction in which the character is moving, so if you were to travel in a straight line, MoveDirection would remain unchanged. Otherwise, could you try printing the CFrame of the humanoid itself?

If it was moving it in a straight line on the Z axis in a positive direction, wouldn’t the MoveDirection be 0,0,1 because that would be the direction the character is moving?

I printed the CFrame after running the command, you can see it’s changing but the MoveDirection stays at 0,0,0:

try

print(humanoid.MoveDirection.Magnitude)

Doing that still outputs 0 unfortunately.

image

Yes, I’m just trying to rationalise. What happens if you travel in the X direction instead? Could you print the lookvector of the humanoid?

1 Like

I think you meant the HumanoidRootPart (if it’s something else let me know), here’s me moving it in the negative X direction (it didn’t rotate much which is why the LookVector hardly changed)

I moved it in the opposite direction as well, you can see the humanoid root part’s LookVector is changing:

https://developer.roblox.com/en-us/api-reference/property/Humanoid/MoveDirection
Judging from the NotReplicated and the code example being a local script, my best guess is that you simply cannot use this property, not even for server-owned walking figures.

To get the movement direction, you should do (position_you_called_MoveTo_on - current_position).Unit or try something else than MoveDirection.

edit: use something more appropriate for determining if the rig is idle, rather.
Such as it no longer being in the walking state, or its horizontal velocity being small.

4 Likes

Yeah I guess you’re right. I tried doing :MoveTo on my character from the server only to have it not change. Sucks.

Interesting. I guess you could just use the LookVector of the HumanoidRootPart anyway.

3 Likes