Using points to complete an objective

I’m just trying to make it so that when points is equal to two, then the block game object is set to active.

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;

public class PlayerScript : MonoBehaviour
{
    private int thePoints = 0;
    private object scoreMessage;
    public Scene scene;
    public Text piecestext;
    public GameObject block;

    // Start is called before the first frame update
    void Start()
    {
        string scoreMessage = "Pieces = " + thePoints;
        scene = SceneManager.GetActiveScene();
        SetPieces();
        block.SetActive(false);
    }

    // Update is called once per frame
    void Update()
    {
        print(scoreMessage);
        if (Input.GetKeyDown(KeyCode.F))
        {
            Application.LoadLevel(scene.name);
            print("F");
        }
    }

    void SetPieces ()
    {
        piecestext.text = "Pieces = " + thePoints;
    }

    public void AddPoints ( int amount )
    {
        thePoints += amount;
        Debug.Log("Points = " + thePoints);
        piecestext.text = "Pieces = " + thePoints;
    }

    void ObjectSpawn()
    {
        if (thePoints == 2)
        {
            block.SetActive(true);
        }
    }

}

Thanks

A very simple way is to use a setter

        private int _thePoints;

        private int thePoints
        {
            get { return _thePoints; }
            set
            {
                _thePoints = value;
                ObectSpawn();
            }
        }