# Calculate angle for X rotation for CFrame

This is my current script in calculating the Y angle that I then use on CFrame.Angle() which works, But I am looking how I can also do the same but for X axis as I’m not familiar with roblox math functions but do know trigonometry in real life.

``````local Magnitude = (plr.Character.Head.Position - Target.Position).Magnitude
local Height = math.sqrt((plr.Character.Head.Position.Y - Target.Position.Y)^2)
local Sine = Height / Magnitude
local Angle = math.asin(Sine)

waist.C0 = waist.C0:Lerp(CFrame.Angles(Angle,0,0), 0.1)

--for value after angle I wanna find the X angle that I can rotate brick with

``````

What is the end goal of this code? That will help me formulate the answer you’re looking for. You want the waist to face a target?

This is what I’m attempting to achieve:
The code will find an angle on the X axis to allow me lerp the waist.C0 to the direction of the torso.

This is a duplicate post. I’ve already done this for you here yesterday.

How would I convert lookat() to CFrame? - Help and Feedback / Scripting Support - Roblox Developer Forum

Using a singular angle isn’t optimal for this. If you want to negate and axis have .lookAt use the same Y value for both position arguments.

Forgot about that post today but yeah good explaining