Is there any fast way to figure out

Is there any way to figure out the movement direction relative to the humanoid root part—like a movement direction value?

For instance, if I were to go in shift lock and move forwards (w), it would give me a cframe or vector3 value (0,0,1) and where if I were to go diagonal, it’d be (-1,0,1)?


I bet this is super easy and the solution will be like a “duh” moment, but this has me stumped for now :woozy_face:

1 Like

Have you tried using HumanoidRootPart.Velocity?

I’ve seen movedirection, Its close but not exactly what I need.
I need it to be relative to the humanoid root part, not the world.

Yeah I realized that was wrong, sorry.

The Humanoid has a MoveDirection property that reflects the normalized move direction. For example, if you’re holding W, MoveDirection will be 1 in the direction you’re facing, but if you’re holding W and D, MoveDirection will be something like 0.704 in the two component directions.

The control script exposes a function for getting the raw input for move direction. If you’re using the keyboard, the output Vector3 will always have components of 1, 0, or -1. (Not sure about these values if you’re using a controller, they might be any value between 1 and -1.)

local controls = require(game:GetService("Players").LocalPlayer.PlayerScripts.PlayerModule):GetControls()
controls:GetMoveVector()
8 Likes

Thanks! It’s exactly what I’ve been looking for. :grin: