How to make the character face a position but not go up and down

I want to make my player aim where the mouse is since it is holding a gun. problem is if I were to just make it point towards the mouse it would rotate upwards and I only want it to rotate sideways. Something like Shiftlock where you camera locks to it sideways but not upwards and downwards.

if you see i want it to act like how it is in shiftlock mode and when you click the mouse or shoot it just makes you glitch upwards

Can you provide the script you used? I would also add a decal on the bullet to see which way it’s pointing btw.

You need to learn how Euler’s math works
You need to get only pure Pitch without yaw and without roll:

local HumanoidRootPart:Part = ...path.to.humanoid.root.part
local Bullet = ...path.to.bullet
local origin,look = HumanoidRootPart.Position,Bullet.Position
local pitch = math.asin(look.Y)

local cf = CFrame.lookAt(origin, origin + Vector3.new(0, math.sin(pitch), -math.cos(pitch)))




Not sure if its the right formula tho

Instead of making the character look at the bullets position directly, make it look at this:

Vector3.new(bulletsPosition.X, charactersPosition.Y, bulletsPosition.Z)

I also recommend using AlignOrientation to turn characters, as theyre less glitchy in most cases when it comes to rotating characters

basically all I wanted was for the character to point towards the mouse at all times as if it were in shiftlock without having your mouse dead center. And if I were to use what I did it would just make my player go up and down, which I only want it to go left and right.

does anyone have an idea on this yet? just wondering