Death Screen?

I have a 2D game called polyshics. I added a death screen, a player and 2 obstacles:

  • red platforms
  • the void

the player can step on orange ones, but will die on red ones.

the void are these two bars on both sides that are supposed to show the death screen.

I used the same script for both of these obstacles, but only the red platforms work. This is the code i used:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
     
     public class Die : MonoBehaviour {

         private void OnCollisionEnter2D(Collision2D collision) {
             // Put your scene name where "SceneName" is.
             SceneManager.LoadScene("DeathScreen");
        }
     }

If anyone has a solution for the void working, please let me know so I can type it into a different script

Did you add your scene to the Build Settings?
Did you assign this script to the red boxes?