Help with using a Viewport Frame

I need help with making the viewport always be looking at the car like in the video attached


In the video the x6m shows up perfectly in the viewport frame. However, the other car does not even show up at all.
I am trying to make a car dealership system and when the game starts it loads the cars from the “Cars” folder in Server Storage and I know how to do that, but I don’t know how to make the Viewport frame always look at the car like it does to the x6m.

I feel like this should be in scripting support, its where you’re gonna find the most solutions.

There’s a few ways do do this, some more lazy than others, which in turn give worse results.

The most lazy way to do this without scripting is to place your viewport vehicles in the same spot, (preferably 0,0,0), set the viewports current camera property to the workspace’s camera, move the camera to the position you want (around the 0,0,0 coordinate), then duplicate this camera and change the viewports current cam again to this new duplicate. This way the duplicate cam will be fixed in place.

Cons of this method: you will always have to manually set the vehicles position around 0,0,0 and adjust so its within view of the camera, which will always be fixed.

For the best result, and also the most complicated, is to script a custom camera for the viewport, and place this camera’s cframe an x amount of studs away from the viewport car primary part’s cframe, and adjust until you find the angle you like. This way its always gonna be consistent no matter what position the car is in, however, it may take some tweaking with angle and position values until you get it right.

Cons of this method: complexity, Time consuming.

What do you mean by “script a custom camera”?