Scripting help, CS0131

Hi, I’m new to unity and have been trying to create a simple 2D platformer. I am trying to create a block that falls after a delay triggered by touching the player. I attempted to create a script based on things I found online and my own knowledge. I think my code works with exception to the CS0131 error.
Please assist in solving the CS0131 error or give suggestions to improve my code.
Thanks

Code:

using UnityEngine;
using System.Collections;	
public class DelayGrav : MonoBehaviour 
{
	public float delay = 1f;
	private float timer = 0f;

	void Start ()
	{
	}
	void Update ()
	{
	}
	void OnColliderHit (Collider other)
		{
		timer += Time.deltaTime;

		if (timer > delay) 
			RigidbodyConstraints2D.FreezePositionY = false;
		}
}

RigidbodyConstraints2D is an enum flag and is a property of Rigidbody2D. That means you need to access Rigidbody2D to access the Constraints. You need to specify which Rigidbody to use. If the script and the Rigidbody are on the same GameObject, you can use GetComponent.

 GetComponent<Rigidbody2D>().constraints = RigidbodyConstraints2D.FreezePositionX | RigidbodyConstraints2D.FreezeRotation;

If the RIgidbody body is else where then a public property can be used to store the reference.

public Rigidbody2D rb;

void OnColliderHit (Collider other)
{
    timer += Time.deltaTime;

    if (timer > delay) 
        rb.constraints = RigidbodyConstraints2D.FreezePositionX | RigidbodyConstraints2D.FreezeRotation;
    }
}

Another way is to store the component during Awake or Start so it can be used later, this assumes the script and the Rigidbody are on the same GameObject:

 private Rigidbody2D rb;
 
 void Awake()
 {
    rb = GetComponent<Rigidbody2D>();
 }

void OnColliderHit (Collider other)
{
    timer += Time.deltaTime;

    if (timer > delay) 
        rb.constraints = RigidbodyConstraints2D.FreezePositionX | RigidbodyConstraints2D.FreezeRotation;
    }
}

More info about Enum Flags and bitwise operators.

Unity Script API: Rigidbody2D.constraints