Freeze specific rotation axis of a child

How to freeze for example only y or z axis but still copy x axis of a child?
-Thanks

Check this out to freeze specific axis:
Rigidbody Constraints

To freeze the X axis use this code:

rigidbody.constraints = RigidbodyConstraints.FreezeRotationX;

If you need to apply this to a child, they will already have a rigidbody (otherwise, you don’t need to do this) so just reference the child’s rigidbody and execute the same code on it.

You can either do that by code or just simply add a rigid body on it and freeze the axis’s you want. I don’t know if the rigidbody will work on a child, but you can try it.