find tag from raycast

hi everybody ive been trying to make an if statement so when i click the block it get destroy depending on the item equipped and the item your trying to mine i tried different ways i have problems identifying the tag for the times heres the scripts

` if(Input.GetMouseButtonDown(0 && WoodShovel.ShovelSelected == true) || Input.GetMouseButtonDown(1))
{
var Hit : RaycastHit;
var LookingDirection = transform.TransformDirection(Vector3.forward);

	if (Physics.Raycast(transform.position,LookingDirection, Hit, Range))
	{
		if(Input.GetMouseButtonDown(1))
		{
		
		
		if (BlockSelected == 1)
		{
			var GrassBlock : Transform = Instantiate(GrassBlock, Hit.collider.transform.position + Hit.normal.normalized, Quaternion.identity);
			GrassBlock.tag = "GrassBlock";
		}
		
		if (BlockSelected == 2)
		{
			var StoneBlock : Transform = Instantiate(StoneBlock, Hit.collider.transform.position + Hit.normal.normalized, Quaternion.identity);
			StoneBlock.tag = "StoneBlock";
		}
	}


else
{
	if(BlockSelected == 0)
	{
	if ( Hit.transform.tag == "GrassBlock"){
	Destroy(Hit.transform.gameObject,WoodShovelDestroyTime);
	}
	else
	{
	Destroy(Hit.transform.gameObject,12);
	}
	
	}
	if(BlockSelected == 1)
	{
	Destroy(Hit.transform.gameObject,GrassBlockDestroyTime);
	}
	if(BlockSelected == 2)
	{
	Destroy(Hit.transform.gameObject,StoneBlockDestroyTime);
	}
}
}

}`

Try the 3D equivalent of this:

// store the position of the mouse click
mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
//Cast a ray to detect object clicked
Raycast2D  hitObject = Physics2D.Raycast(mousePosition, new Vector2(0, 0), 0.1f, mask);

//can now access the tag and/name from the hitObject's transform
string objectTag = hitObject.transform.tag;