Help with forcing a character to face a certain direction?

I’ve always used CFrame.fromMatrix to make a part face a specific way and it’s always worked, you mainly give it your RightVector and the UpVector which then it fills in the LookVector.

Here’s an example:

local BodyGyro = Instance.new("BodyGyro")
BodyGyro.D = 0
BodyGyro.MaxTorque = Vector3.new(0, math.huge, 0)

local forwardVector = (Player.Character.HumanoidRootPart.Position - SpellDetails.TargetPos).Unit
local rightVector = forwardVector:Cross(Vector3.new(0,1,0))
 --^Cross it with a temporary UpVector
local upVector = rightVector:Cross(forwardVector)
local cframe = CFrame.fromMatrix(Player.Character.HumanoidRootPart.Position, rightVector, upVector)
--^Going back to emojipasta's reply of using the HRP's position

BodyGyro.CFrame = cframe
BodyGyro.Parent = Player.Character.HumanoidRootPart

FYI: As I just did in that example, you should Parent the newly created Instance yourself instead of using the second argument as that can have consequences such as delays, inefficiencies etc.
You can read more here:

1 Like