I want an object to be rotated in a way so that it lines up with the player’s HumanoidRootPart LookVector. My problem is the object is facing the wrong way when using the code below.
Code so far:
I want an object to be rotated in a way so that it lines up with the player’s HumanoidRootPart LookVector. My problem is the object is facing the wrong way when using the code below.
Code so far:
You would use CFrame.lookAt()
CFrame.lookAt(Position: Vector3, FacingAt: Vector3)
Handle.CFrame = CurrentPlayer.Character.HumanoidRootPart.CFrame
sorry i accidentally clicked “Reply” in the previous post
handle.CFrame = CFrame.lookAt(handle.Position, handle.Position + HumnoiadRootPart.CFrame.LookVector)
The first parameter of the function is the position.
The second is where it is facing. The way you do this is by adding the LookVector of the HumanoidRootPart (this is the rotation) to the position of the handle. So you add the rotation to position
you multiply it by CFrame.Angles(0,math.rad(180),0)