You need a pair of scout parents. This was stated in the OP where he used a Scraggy. I for example, use Pachirisu it has one of the lowest bas egg hatching rates and has 3 ability slots to scout for abilities. Get a pair of those and/or Magikarps from the Friend Safari/Route 3. Now you've got your Magikarps (using for demonstration purposes but can be Pachirisu) you can put a Destiny Knot on one and Everstone on the other (make sure the parents both have a neutral nature i.e Docile, Quirk etc.) Go to the Battle Test in Lumiose City and put in a Magikarp with two other random Pokémon with the Magikarp not leading. This way you can go the Magikarps Summary and check it's stats. Record all the stats from each parent. Since you've recorded the stats you can now place your Magikarps in the daycare. Run around and reject the first egg. Save right after you do so. Generate a new egg with the same parents, hatch it, and check the offspring in the Battle Test. The stat that is not the same as the Male or Female is the one that is being randomly generated. If you get attack randomly generated and you're going for an special attack spread throw in some new parents that you want to produce a 5 IV offspring from (making sure that they've got the perfect IV's in which the offspring corresponded to on both the male and female.) The result should be a perfect 5 IV with your specified nature. Other things to note are that the gender and ability is LOCKED in as well as the IV spread when you reject the first Magikarp egg. If however, the new parents you put in for the Magikarps are a different gender ratio than 50-50 the gender is now rerolled and random. A video explaining what I just said can be found here. Since you're going for shinies, if the offspring of the Magikarps is shiny you MUST put in a new pair of parents where one is an alternate country to keep the Masuda odds. If you don't do that the new offspring will NOT be shiny. If you don't like the IV spread or the offspring is not shiny (with your odds it's 1/1024) just soft reset and it will bring you back to where you saved after you rejected the egg. Once you do this just generate another egg, reject it and save again. Again, not the best explanation so you might wanna check the video out.