changing servo from sg90 to mg996r coding doesnt work?

Post a wiring diagram (hand drawn, not Fritzing).

Which will show, of course, that you are not trying to power the servo from the 5V Arduino pin.