Tring to build a sound activated servo but code won't work

You simply drag in the photo to the reply box.

That suggest you have not connected the ground from your sensor to the ground of the Arduino. Which we should be able to see once we see the schematic.