How to calculate players moving direction

How could i calculate the players moving direction? thanks for helping

you can use Humanoid.MoveDirection on the character I think

4 Likes

Above reply or for some specific cases rootPart.CFrame.LookVector should suffice.

Expanding on what @BirdieI90 said: especially if you’re trying to detect movement in the player, Humanoid.MoveDirection.Magnitude would likely be better for most cases.

1 Like

Could also use the player module to get the current input from the player (WASD on PC and the trackpack move direction on mobile) like this:

local Players = game:GetService("Players")

local localPlayer = Players.LocalPlayer
local playerScripts = localPlayer:WaitForChild("PlayerScripts")
local playerModule = require(playerScripts.PlayerModule)

local inputVector = playerModule:GetControls():GetMoveVector()
print(inputVector)

well like humanoid.MoveDirection.Magnitude:Dot(camera.CFrame.RightVector etc) is good for my script of side dashes but if i dont use shiftlock its not that good

alright imma try that that seems promising

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.