I'm literally stuck in the game because by the Ultra form of this Pokemon I can't beat it just one ko's my whole team please help me...
The best way to get rid of Ultra Necrozma without glitches is by using ghost z-moves. Using Marshadow, Decidueye or Mimikyu is a good answer. You might also want their affection to be MAX so they can attack with a normal super-effective move one more time. If it hasn't fainted, send out another Pokemon (preferably an offensive Pokemon with MAX affection or a defensive Pokemon that can use moves like Leech Seed and Toxic), then chip away the remaining health it has. Again, I recommend your Pokemon have lots of affection so they have a free Focus Sash. You can also use any other super-effective z-move, such as Devastating Drake. Every starter does pretty good against it, so that's really all you need to do. Or, you can have a Pokemon with Attract or Swagger to make it easier. I also recommend doing some research on Ultra Necrozma, since you'll quickly find out the Pokemon that deal with it pretty fast. If you're able to get Hoopa Unbound, that also is a good answer.
I think I found a glitch or exploit.
Find a Mimikyu, or just use the Totem Mimikyu. Teach it Toxic (available in Aether Paradise), and since it has Disguise, you'll be able to poison this Necrozma. It will get KO'd after, but this is where the next part comes in. Be sure to have a Pokémon weak to Psychic moves as your last party member! Send out a Zorua or Zoroark, it'll become the Pokémon last in your party. You can find a Zorua in the Trainer's School. Ultra Necrozma will just spam Photon Geyser, which will do nothing, until the poison has it faint!
Edit: You can teach the Zorua/Zoroark Toxic, but I didn't, just in case the Necrozma would use a different attack if I fought back.
Just use a mimikyu with destiny bond, It worked for me
Focus Sash + Endeavor + Quick Attack Rattata
This is how you beat him with taking no dmg, lead with Zoroark that is a primarina with Illusion, U-necrozma will only use phton geyser, which Zoroark is immune to. It took me only 2 foul plays to then kill him ;)