Percocet is an opioid analgesic -- it treats pain.
But included in the side effects are nausea and fatigue, which can cause some to lose weight.
Since Percocet treats pain, a person in pain will feel better and have more energy. Potentially, since they are feeling better, they may eat more and gain weight.
But the medication itself has no effect on weight gain or loss.
There is only ONE thing that causes weight gain: food.
Why do two people who eat the exact same thing gain/lose weight differently?
Food gets converted to calories. Simplistically (leaving out lots of variables), If you burn off less calories than your intake, you gain weight. If you burn off more calories than your intake, you lose weight.
When people exercise/run/treadmill/jumpingjacks, etc., they are trying to burn off more calories than the amount of calories taken in.
You asked about percocet, a brand name of an opiate, "oxycodone." Opiates are known to change one's metabolism, as well as have effects on blood sugar. However, each person is different.
You look at some movie stars that bloat right up -- word gets out, "Oh ya, so-and-so is hooked on pills." You look at other movie stars who are very thin, and word gets out, "Oh ya, so-and-so is hooked on pills." So, opiates affect people differently.
However, if you are taking your pain medication as prescribed, in a disciplined manner, and concurrently WATCH what you eat, doing so in a disciplined manner, it is not likely the opiates will affect you adversely, weight-wise.
But, here's the thing -- you take some pills, your brain now feels that "opiate euphoria satisfaction/satiation." You are "satiated." You may not be "in the mood" for a nutritious meal, or, any food at all. You have to WATCH that! Make SURE you are eating healthy. And, particularly, make sure you eat balanced, and watch for constipation.
Most importantly, since we here on this forum aren't allowed to "give advice," I want you to please talk to your doctor about this. I don't know how good your insurance is, or if you can afford it, but let me tell you -- it would be a GOOD idea if your doctor referred you to a medically qualified nutritionist. And, it will be fun! Well -- for ME that would be fun -- I LOVE to talk about food! And, if it doesn't cost you too much, I say GO FOR IT -- talk to a pro about some good nutrition tips! I assure you, by the end of the visit, you'll be on a better path to eating even better and more healthily!
Good luck, best wishes!