Microsoft MakeCode

Servo Question

Please help - I’m a teacher and class is trying to make a robot with a head that turns. The TowerPro servo is supposed to move from 30 to 150 degrees. Instead it is moving unreliably and often crazily backwards and forth after reaching near to its angle. Image of code and video of problem - Links below
I am using a battery pack of 4AAA to power that servo. Is it a power problem? I have replaced all batteries and done a lot of testing with code and servos, and still cant find a solution.

I can’t quite tell from the video: Is the Micro:bit ground (GND) connected to the battery and servo ground? (It looks like it may be, but it’s hard to tell if the wire is really connected)