Hi, I’m looking for a reliable way to force a character into facing a specific direction; so far, this is the method I currently use however it has it’s drawbacks and issues.
The method should work fine, one thing I noticed about your code is that you’re constructing a CFrame with a blank vector as origin, you should replace that with HumanoidRootPart.Position.
Setting a Humanoid’s WalkSpeed to 0, and using the Humanoid:MoveTo() function will force the character to face in the direction of the part/position that is specified inside of the parentheses. Obviously, this only works so-long as the character doesn’t need to move while you are having them 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: