I am creating a fish tank, in which I am tweening several fish around to a random CFrame position within the boundaries of the tank. This is done on the client, and it is quite simple, until I noticed that it would cause significant FPS drops (60 to 30). I added a check that only makes the fish move when you’re within 50 studs of the tank, so this proves to me that the tank is causing the FPS drops, as I have a steady 60 FPS when I am not near it.
I played around with this for a while, and noticed that when I put the exact same fish tank & scripts into another game, the FPS was 60. If I moved the fish tank away from the building that it is inside in the original game, I went back to a steady 60 FPS. This shows that the FPS drop is a result of the building that it is inside of, but the build does not cause any drops on its own. After a while of experimenting in studio, I noticed that deleting all the meshes made my FPS stay at 60 and not drop.
I’m not sure why tweening an object in a building full of meshes is causing a significant FPS drop. The code is completely fine considering that it has no problems when it is away from the building. The number of fish swimming in the tank (1 vs 8) also does not have much of an impact on it, as the FPS still drops regardless of the number.
There isn’t really that much meshes, and most of them are duplicates of each other, so I’m not sure how it could be that intensive on performance. I’ve asked several others, and I’m pretty much lost in terms of what to do here. The code seems to be fine, and deleting every mesh isn’t really an option here.
I appreciate any help.