How do I program a MG996R?

Please help
I’m trying to program an MG996R to rotate from 0 degrees to 90 degrees, stop for 5 seconds, rotate back to 0 degrees and end program. I have tried a few codes found on the internet but none give me my desired output. I am using an Arduino Uno to program my motor and my motor is being powered by an external source proving 5V at 2amps.

Any help will be appreciated thanks

/*
Arduino Servo Test sketch
*/
#include <Servo.h>
Servo servoMain; // Define our Servo

void setup()
{
servoMain.attach(10); // servo on digital pin 10
}

void loop()
{
servoMain.write(45); // Turn Servo Left to 45 degrees
delay(1000); // Wait 1 second
servoMain.write(0); // Turn Servo Left to 0 degrees
delay(1000); // Wait 1 second
servoMain.write(90); // Turn Servo back to center position (90 degrees)
delay(1000); // Wait 1 second
servoMain.write(135); // Turn Servo Right to 135 degrees
delay(1000); // Wait 1 second
servoMain.write(180); // Turn Servo Right to 180 degrees
delay(1000); // Wait 1 second
servoMain.write(90); // Turn Servo back to center position (90 degrees)
delay(1000); // Wait 1 second
}
this code if off the internet and seems to work the best out of the other codes that I have tried

Post the code you're working with and post a wiring diagram of your complete setup!

I'm trying to program an MG996R

Is that device really programmable?

Use the code you show, delete what you don't want, change delay(1000) to delay(5000).

none give me my desired output

This is not a helpful description.

What does your code do, and how does that differ from what you expect?