If you gain muscle you'll be gaining weight. If you're incredibly overweight then you can lose fat, gain muscle, and lose weight. If you're not, you'll gain weight. Muscle mass is heavier than fat mass. Even if you're losing fat the muscle mass weighs more.