Purpose of flathead screws?

How wrong you can be. While a phillips head is exclellent for many purposes it requires a lot of down force to keep the driver tip from lifting out of the screw. This is sometimes a self limiting factor on how much torque that can be applied to tighten a screw.

Straight slot screws - I’m sure you meant that as flat head means something different - are just about the only thing used in high precision items like guns. High force can be applied where needed or a measured amount where a specific force is required.

If you’ve had problems with straight slot screws it’s probably your screwdriver. Typical hardware store screwdrivers are crap. Poorly shaped and fitted tips will just damage screw slots and frustrate the user. For $20-30 you can get a starter gunsmith screwdriver set that has straight slot tips of varying widths and thicknesses. Once you find a tip that fits the slot perfectly you’ll see that straight slot screws can be superior to Phillips, Reed & Prince or hex key types.