how to make Directional Blocks?

You know Minecraft right? If so, look, I try instant objects but they put their faces according to the angle the player is at like Minecraft when you put a kiln block, this always has the face where the player sees that’s what I want to do sometimes it works with transform .rotation but this is not very precise I want it to be only 0, 90, 270, 180 in advance thank you very much for the help.

 RaycastHit hit;
        if (Physics.Raycast(camera.position, camera.forward, out hit, rayDistance))
            var select = hit.transform;
            if (select.CompareTag(GameObjectTag))
                var selectRenderer = select.GetComponent<Renderer>();
                if (selectRenderer != null)
                    selectRenderer.material = highlightGameObjectMaterial;
                    if (Input.GetKey(KeyCode.Y))
                        Vector3 spawnSpot = hit.collider.transform.position + hit.normal;

                        //Instantiate(well, spawnSpot, Quaternion.identity);
                        //Instantiate(well, transform.position + (transform.forward), transform.rotation);
                        Instantiate(well, spawnSpot, transform.rotation);

                selectedGameObject = select;

When you instantiate a gameobject the third argument sets the rotation and right now you have set the rotation to be the same as that of the gameobject that holds the script (which is the same gameobject that holds the camera, i presume). Instead of using ‘transform.rotation’ (the rotation of the current gameobject), you should instead use ‘Quaternion.Euler(x, y, z)’, where you define the rotation with the x, y, and z values. So line 21 should look something like this:

Instantiate(well, spawnSpot, Quaternion.Euler(x, y, z));