There is an ultrasonic sensor conrolling a servo, it won't work even with this code from (https://Instuctables). I tried my own code I tried switching parts, I tried changing wires.
What makes it worse is it used to work and i need it done in a couple days. Is it broken because I put in a box with a battery pack?
You appear to be powering your servo from the Uno's 5V pin.
What is the stall current of your servo?
How much current can your USB port supply?
And in the event you power the Uno through the barrel connector with sufficient voltage (>7V), can the Uno's 5V regulator supply the servo's stall current? (Hint: likely not).
If the servo's operating range is 4.8 to 6V, then 3.3V volts is unlikely to do the job. Also, you did not answer how much current the Uno's 3.3V regulator can supply. Another hint: it's not enough to power a servo, even if the voltage was within range.