Squash plants have two different flowers: male and female. For fruit to grow successfully, pollination needs to occur between the two different types of flower.
If your fruit is turning black and is rotting it means it hasn’t been pollinated properly.
The photo above shows the male flower, which is usually on a long straight stem coming from the main plant.
If you look inside, you will see they have a single stamen on the with pollen on it.
The photo above shows the female flower. You should be able to tell which ones are female flowers because they will have the fruits attached.
This one was closed, so I had to use my fingers to open it up. The female flower has a multi-stemmed stigma on the inside and without meaning to sound crude, it looks like the female form on the human anatomy.
In the above photo you can see where I’ve taken some pollen from a male flower stamen (the bright yellow powder) and rubbed it onto the female flower stigma. Try to get it onto all parts of the female stigma.
Try and check your plants every day to see if there are any female flowers that need pollinating. They tend to wilt quickly and then they fall off, leaving you with rotten fruits!