Can't rotate an object if it is connected with FixedJoint2D

So I’m making a 2d game where you can build stuff from blocks by connecting them. My best idea was to connect them with a fixed joint. After struggling with blocks teleporting all around, I finally fixed everything, exept for blocks not rotating right. I’ve been trying to fix it all day but no luck.

What I’ve been doing is checking if the selected block is close enough to other block, then selecting the closest location where it can go, and connecting the two blocks with a joint. It all works fine, but if the block has different rotation than the block it is connecting to, it just keeps it! I tried setting it’s rotation in all the places that I could, but for some reason it just turns back! Print command (Debug.Log) showed that it is turning, but only for one frame, and you can’t really see it. Angular drag is set to zero.

Can someone help me?

This is the code that connects joints:

public GameObject thisBlock;
GameObject selection;
GameObject connectionPreview;
GameObject pointList;
BlockScript blockScript;
Rigidbody2D thisRb;

private bool colliding = false;
public GameObject collisionBlock;
private BlockScript collisionBScript;

private GameObject previewBlock;
private GameObject collisionPList;
//private bool hasJoint = false;

void Start()
{
    thisBlock = transform.parent.gameObject; // This one is the parent, the block
    selection = thisBlock.transform.GetChild(0).gameObject; // This is the selection that gonna show up when near a selected block
    connectionPreview = thisBlock.transform.GetChild(1).gameObject; // This is the connection preview
    pointList = thisBlock.transform.GetChild(3).gameObject; // This is the set of points to calculate distance to

    thisRb = thisBlock.GetComponent<Rigidbody2D>();
    blockScript = thisBlock.GetComponent<BlockScript>(); // Gets blockScript from the block
}

private void OnTriggerEnter2D(Collider2D collision)
{
    collisionBlock = collision.gameObject;
    GameObject collisionParent = collisionBlock.transform.parent.gameObject;
    collisionBScript = collisionParent.GetComponent<BlockScript>();
    colliding = true;
}

private void OnTriggerExit2D(Collider2D collision)
{
    collisionBlock = null;
    collisionBScript = null;
    colliding = false;
}

public void ConnectBlocks()
{
    if (collisionBlock != null)
    {
        GameObject collisionParent = collisionBlock.transform.parent.gameObject;
        collisionPList = collisionParent.transform.GetChild(3).gameObject;
        Rigidbody2D prevRB = collisionParent.GetComponent<Rigidbody2D>();
        if (prevRB != null)
        {
            FixedJoint2D joint = thisBlock.AddComponent<FixedJoint2D>();

            joint.autoConfigureConnectedAnchor = false;

            joint.connectedBody = prevRB;
            joint.connectedAnchor = GetColClosestPoint().localPosition;
            joint.anchor = new Vector2(0, 0);
            joint.breakForce = 600;

            thisBlock.transform.rotation = collisionParent.transform.rotation;
        }
    }
}

Transform GetColClosestPoint()
{
    Transform returnPoint = null;
    float maxDistance = 999999;
    int childCount = collisionPList.transform.childCount;
    for (int i = 0; i < childCount; i++)
    {
        Transform point = collisionPList.transform.GetChild(i);

        if (Vector2.Distance(point.position, thisBlock.transform.position) < maxDistance)
        {
            maxDistance = Vector2.Distance(point.position, thisBlock.transform.position);
            returnPoint = point;
        }
    }
    return returnPoint;
}

void Update()
{
    if (colliding)
    {
        if (collisionBScript.clicked)
        {
            SetSelection(true);
            SetPreview(true);
        }
        if (!collisionBScript.clicked)
        {
            if (!blockScript.clicked)
            {
                SetSelection(false);
                SetPreview(false);
            }
        }
    }
    if (!colliding)
    {
        if (!blockScript.clicked)
        {
            SetSelection(false);
            SetPreview(false);
        }
    }
}

There is some function such as SetPreview(), but they all are fine.

This is the other script, which checks for mouse clicks:

public class BlockScript : MonoBehaviour
{
    private GameObject selection;
    private ConnectionScript connectionScript;

    [HideInInspector]
    public bool clicked = false;
    public bool mouseDown = false;

    void Start()
    {
        selection = transform.GetChild(0).gameObject;
        connectionScript = transform.GetChild(4).GetComponent<ConnectionScript>();
    }

    void OnMouseDown() // Select the object
    {
        clicked = true;
        mouseDown = true;
        selection.SetActive(true);
    }

    void OnMouseUp() // Deselect the object
    {
        clicked = false;
        mouseDown = false;
        selection.SetActive(false);

        connectionScript.ConnectBlocks();
        GameObject colBlock = connectionScript.collisionBlock;
        if (colBlock != null)
        {
            print(colBlock);
            connectionScript.thisBlock.transform.rotation = colBlock.transform.parent.rotation;

        }
    }
}