Could be a pollination issue.
The female flowers come with baby squash already behind them. If the flower is not pollinated, the baby squash grow for a little while and then just shrivel up and die.
So you need to check to be sure you have both male and female flowers present (the male flowers do not have the baby squash behind them) and if so are you seeing bees or other pollinators going to them. If you have male and female flowers but no bees, you can hand pollinate.