It might be best to start life first as a female, breed several times until you are quite large, and them change to a male where you can mate with other females. In this way, you would do better than if you remained one sex your entire life. A good example is the Blue Headed Wrasse. Male is brightly colored, females dull. Large males may spawn 40 times a day with different females.
Individuals start as females and then eventually some change to males.
This is socially controlled. The females establish dominance hierarchies with up to 20 females and one male in a group that inhabit a small patch reef. When the male dies, the larger, dominant female changes sex in under two weeks. The same gonad that produced eggs starts to produce sperm and the coloration switches. If you then remove that male, the next female switches, and so on.