How do I make a basic kill script?

I’ve tried looking at discussions and can’t figure it out. I want to make it so when my player touches a brick, it gets sent back to start or the last checkpoint it touched, or lose some health.

I am assuming that you already have colliders on the player and the brick. One of the two objects will need a RigidBody2D.

For 2D, the collision function will look something like this:

private void OnCollisionEnter2D(Collision2D collision)
    //Assuming the brick has the tag "Brick"
        //If you want to teleport the player back to some location, you will
        //have to define the location previously
        transform.position = lastCheckpoint.transform.position;

        //If you want to reduce the health, then you'll need a health variable
        //defined in this class
        if(health <= 0)
            //handle death case

        //Getting sent "back to the start" could either be the same behavior as 
        //teleporting to the last checkpoint, or it could involve reloading the
        //current scene.
        //You would have to add "using UnityEngine.SceneManagement; " to do this
        string currentSceneName = SceneManager.GetActiveScene().name;

I’ve included some possible ways to handle the three behaviors you mentioned, but each of those require additional work outside of this function.