Pan camera based on parent location

Hello

I want to pan around a player object (in this case a spaceship from top down) not infinitely just until the player is at the screen edge like such

I’ve looked around but i can’t find something close to it any help would be appreciated

Nevermind i figured it out with the help of my friend, but i know what happens with the old internet and I’m not going to do that so here’s the way i did it