I have a colider error

whenever i run my script called HoldPlayer i get this error and my script cant run. The goal of this script is to keep the player on a moving platform

my script

public class HoldPlayer : MonoBehaviour {

void OnTriggerEnter(BoxCollider2D col2D) {
	
	col2D.transform.parent = gameObject.transform;
	
}

void OnTriggerExit(BoxCollider2D col2D) {
	
	col2D.transform.parent = null;
	
}

}

You trigger method is incorrect, as the message itself says… If you are using the 2D physics, use:

void OnTriggerEnter2D(Collider2D col2D) {} 
void OnTriggerExit2D(Collider2D col2D) {}

Attention: The paramenter is a Collider2D, not a BoxCollider2D. Also, if you are using the 3D physiscs (without the 2D), just delete the “2D” both from the method and from the parameter.