Is this what you are trying to make?
https://howtoconstructdemos.com/auto-zoom-and-scroll-the-screen-to-fit-multiple-characters/
This is literally exactly correct. I sort of understanding how this is working, but I was wondering if I could ask some clarifying questions. I don't fully understand it, and while I could just copy it and walk away, I'd like to understand it more fully so that I can do it myself in the future.
It says for "min" and "max" expressions that it is calculating the minimum and maximum of things, so I assume that if I put in, say, max(3,5,Player.x), then, unless my player x was bigger than 5, it would always return 5, right?
So what those four expressions in the "for each" do is, for every player that is on the screen, calculates the farthest point of the relevant bounding box for that object, then compares it to the previously calculated value from the previous cycle (which is why max is set to 99999, where no object would reasonably be). I see it's using a "min(max" or "max(min" at the very start of each expression, but I'm not quite sure why that part is done...
After all that is done, it finds the center of the box by adding the values together and dividing it by 2, and lerps via delta time x 16 (this number could be adjusted however I want, I'd assume).
It calculates a value to scale the layout to by dividing the difference of the min and max values by the original size of the viewport, then clamps it so it can't go beneath 1.
I'm a little shaky on the math for the viewport calculation (because I am bad at math) but I think I understand the concept.