Prevent jumping again

Hello, trying to prevent my character from jumping again and again so I’m using this script.
The problem is whenever I touch a tile (all tiles are tagged with “Ground”), even when with the head of the player, it lets jump again

any idea how to solve this?

public class PlayerMovement : MonoBehaviour
{
Rigidbody2D PlayerRigidBody;
public bool ground;


void Start()
{  
    PlayerRigidBody = GetComponent<Rigidbody2D>();
    ground = true;
    }
    void Update()
    {
       if (Input.GetKeyDown(KeyCode.Space) == true && ground == true)
       {
        PlayerRigidBody.AddForce(new Vector2(0, 500));
        ground = false;
       }
 }
private void OnCollisionEnter2D(Collision2D collision)
{
    if (collision.gameObject.tag == "Ground")
    {
        
        ground = true;
}

}

Instead of checking if the player touches the ground with his collider you could have an emty gameobject on the player, located at the feets of it and make a Physics.CheckSphere() with a layerMask (and then assign the layer to the ground). This would also prevent the player from jumping after falling off a ground tile.