ON the nest box or IN the nest box?
I have an angled piece of wood on top of nests to prevent roosting there.
Roosts are 2x4, wide side up, nice, stable and comfy.
But sometimes you've got to 'train' them.
My experience was that I had some pullets that the older birds wouldn't let roost with them so the pullets wanted to roost in the nests. I put up another roost just a couple inches lower than the main roost and began removing the pullets from the nests after dark and putting them on their roost. Did that for a couple nights, then started going in at dusk and poking them in butt if they got into the nests(I have 'outside the coop' access to my nests boxes so this was easy). Pretty soon all I had to do was walk in and they would leave the nest and go to the roost so they didn't get poked in the butt. Took about 3 weeks total before they got in the habit of always roosting on the roosts instead of in the nests