How can i instantly rotate the character relative to the move direction

Hello i would like to instantly rotate the character relative to the where the character is going. I know there is a way as i had the line on my old script i loss it, i can’t remember how i did it :confused:

Here is my current attempt (CFrame.LookAt), that unfortunatly doesn’t work.

char.PrimaryPart.CFrame = CFrame.new(char.PrimaryPart.Position, Vector3.new(Direction.X * 5, 0, Direction.Z * 5))

Thank you for your help

I am assuming you are asking for the line for how your humanoidrootpart positions itself

local moveDirection = humanoid.MoveDirection -- define humanoid & its movedirection units
local directionPos = Vector3.new(moveDirection.X * 5, 0, moveDirection.Z * 5))

char.PrimaryPart.CFrame = CFrame.new(char.PrimaryPart.Position, char.PrimaryPart.Position + directionPos)
1 Like

I finally find the lines again

local aln = char.PrimaryPart.AssemblyLinearVelocity
char.PrimaryPart.CFrame = CFrame.new(char.PrimaryPart.Position, char.PrimaryPart.Position + Vector3.new(aln.X*2, 0, aln.Z*2))

Here is it

oh okay could also do that
test
test
test

1 Like

assuming you’ve already connected the line to a connection of a signal as movedirection?

1 Like

My bad i did an error, this work as well, thank you

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