Lock Rotation of an Object to a Certain Value

I’m using a ball in socket constraint, but I’d like to lock the rotation of Attachment0 to a rotation. Here is my code so far:

constraint = Instance.new("BallSocketConstraint")
constraint.Attachment1 = rightHand.RightGripAttachment
constraint.Attachment0 = tool.Sword.Attachment
constraint.Parent = rightHand

Also, the reason I am not using a RigidConstraint is because the RigidConstraint would lock the rotation of Attachment0 to the rotation of Attachment1, which is not what I want to do.