need some help with code

MillerJLee98579:
RoboProto5.ino: In function 'void loop()':
RoboProto5:57: error: 'ping' was not declared in this scope

this is the error i constantly get in my code yet in the original code this error never shows up

That is because you removed the function ping from the sketch.
And keep away from delay. With your current code the response time of the robot is way above 1 second. That is really slow.
Jantje