Know the direction the player is going

Hello! So basically we have 2 Vector3 Units: One for the direction of where the player is going and second for where the player was going last frame.

From these 2 Units I want to know if the player is going left or right.

I really don’t know how the math would be. Any help??

You could use the LookVector of the player’s character’s HumanoidRootPart.

--where 'player is the player object

local character = player.Character or player.CharacterAdded:Wait()

local rootPart = character.HumanoidRootPart
local direction = rootPart.CFrame.LookVector

I’m not sure where you could take it from here but I hope this helps.

game.Players.LocalPlayer.Character.Humanoid.MoveDirection.

1 Like