What's the best way to preview things?

I’m trying to make a Gui that has a list of all the cars you can spawn in the game. However, I’m trying to figure out how you can preview them all without causing too much lag.

The first thing I tried and worked for a long time was just a bunch of ImageButtons with pictures of the cars I uploaded to Roblox. The problem I have with it is they’re lower quality; kinda of fuzzy.

With ImageButtons

The more recent thing I’ve tried is ViewportFrames. But since there’s 79 cars in the game, 79 models in individual ViewportFrames can add up pretty quickly and cause lag and long load times; the trade off being they look better.

With ViewportFrames

So what I’m asking is: Is there another way that’s a good marriage between the two? The quicker load times of ImageButtons and Roblox assets, with the higher quality of ViewportFrames.

Perhaps images that turn into ViewportFrames when you hover over them, so you only ever have 1 ViewportFrame at a time.

How much lag are we talking here? There shouldn’t be much if the ViewportFrame contents are anchored and not moving, and the cameras are kept still too.

3 Likes

All of the parts are anchored and the Camera isn’t moving. Maybe it’s placebo effect just from being worried about causing lag updating to ViewportFrames from ImageButtons. Do ViewportFrames really not have issues when all the parts are anchored and the camera isn’t moving?

I mean, they take up more memory of course, and you might have a delay if you are setting them all up every time the GUI loads, but once created and not moving, I don’t think 79 should cause a problem.

To get reduce the lag spikes whilst creating, you can have these made in advance on the server in studio already in the GUI.

ViewportFrames don’t update if nothing inside them is moving.
They are the exact same speed to render as a normal texture.

So as mentioned by BanTech, you only have to worry about using extra memory, and that’s not really a problem for lots of small Viewportframes.

If you really wanted to optimize it, just have less items created at a time?