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?
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:
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)
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.