2D Raycast not working

I read answers to this kind of problem, and tried to follow the same instructions, but at this point, I don’t know what to do. The raycast hits the player object instead of objects in the Land layer. Could anyone explain to me what is going on?

public class TapToWalk : MonoBehaviour
{
private bool grounded = false;
public LayerMask groundMask;

void FixedUpdate()
	{
		RaycastHit2D hit = Physics2D.Raycast(transform.position, -Vector2.up, 1.0f, 1 << groundMask.value);
		
		if (hit)
		{
			grounded = true;
			Debug.Log (hit.collider.gameObject);
		}
		else
		{
			grounded = false;
		}
}
}

Whats happening is that the player is the first thing the ray hits.

What is groundMask?? I don’t see that you set it anywhere.

You should be defining a named layer for the ground and then using
Unity - Scripting API: LayerMask.NameToLayer to find its layer number.