If you have a variable where you have amount of stars, all you need to is spawn the correct amount of stars. You could so it with this sort of event:
For 0 to AmountOfStars - 1
Create Object Star at (X+50*loopIndex, Y)
The X+50*loopIndex makes sure the stars are not spawned on top of each other, but 50 pixels apart.