RigidbodyConstraints.FreezePositionX unfreezes rotation

Im having a problem with RigidbodyConstraints.FreezePositionX
When I execute it it unfreezes the rotation of my player
Here is my script

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
   public class End : MonoBehaviour
        public GameObject player;
        private void OnTriggerEnter(Collider other)
            Rigidbody rb = player.GetComponent<Rigidbody>();
            rb.constraints = RigidbodyConstraints.FreezePositionX;

“player” is my player and the Rigidbody is attached to the player

Well rb.constraints is a bitmask. You either have to combine all the flags you want to freeze, or just “add” the positionX flag to the mask by using the bitwise or

rb.constraints |= RigidbodyConstraints.FreezePositionX;

To remove a bit from a bitflag you would do

rb.constraints &= ~RigidbodyConstraints.FreezePositionX;

As I said, in order to set the mask to a certain combination you just would do this

rb.constraints = RigidbodyConstraints.FreezePositionX | RigidbodyConstraints.FreezeRotationX;

This would freeze the position on x and the rotation on x.