So basically, I wanted to make the PrimaryPart of a character look at a part without looking down or up. For example, Isle, when you shoot a gun at a person, you click on them, and then you stare at them through a script without looking down or up and then shoot.
local ObjectPosition = Part.Position -- part you want to look at
PrimaryPart.CFrame = CFrame.new(PrimaryPart.Position, Vector3.new(ObjectPosition.x, PrimaryPart.Position.y, ObjectPosition.z))
You can also use bodygyro to rotate the player smoothly, if that’s what you want to achieve.
local BodyGyro = Instance.new("BodyGyro")
BodyGyro.Parent = PrimaryPart
BodyGyro.MaxTorque = Vector3.new(0,40000,0) --Notice we put only force in Y axis as to rotate on the Y axis only, not up and down
BodyGyro.CFrame = Targetpart.CFrame