Trying to change servo sweep speed based on number of people in a room

You're going to have to use millis() and there are plenty of good tutorials about. Try
https://forum.arduino.cc/index.php?topic=503368.0
https://forum.arduino.cc/index.php?topic=223286.0

Then please show us your best attempt at using them and we'll start from there. I doubt if anyone is just going to want to rewrite your code for you without any input by you.

BTW thanks for working out how to post code correctly. You're already well ahead of many people here ;).

Steve