I have released my game yesterday but I don’t know why but it is very laggy and I don’t know how to proceed. I have found that earlier levels are laggier than later ones and I simply cannot figure out why. Could it be the number of NPCs? I’m looking at the memory usage and a lot of the memory being used is from GraphicsTexture, I look up the URLs and it seems to be avatar textures. I’m afraid I have a memory leak or something and I really just don’t know how to proceed, I’m disconnecting old events and destroying instances which aren’t being used anymore.
If you want to try it out to give some suggestions, here’s the link:
UntrackedMemory isn’t a problem iirc, its just unused memory roblox isnt deleting yet and has no impact on performance, it will be deleted as soon as its needed
As for the rest, I can look more closely at it later (I gotta go now) if I remember
Common sources of lag Ive found is like youre kinda hinting at, textures and decals
And also physics
Whatever changed between early and later stages can make an impact. Whatever you are doing or not doing in later stages is doing something. I would recommend looking at the amount of textures and meshes because those can cause lag. NPCs could impact performance.
I’m fairly certain NPCS are the issue. I’m looking towards and from the NPCs atm and it seems to be laggy when further away. Earlier levels are shorter and more condensed as well so that probably has an impact.
First, make sure anything unnecessary in the game is removed. Second, don’t use too many textures. Third, make sure there’s not a lot of infinite loops. (while true do) loops with no breaks or waits. This should help. (MAKE SURE SCRIPTS ARE NOT INSERTING PARTS.) This causes lag a lot of the time.
I think the issue was mainly NPCs, it seems to be reduced after I removed all of them. There are also some scripts cloning parts as if I didn’t have them, they wouldn’t be smooth, although there aren’t a lot of them.
If there are more than 2 clone scripts that do the same thing, put it into one. This is always a good practice. (Do the same thing like cloning the same part into 2 different clones, etc…)
Nope, it seemed to be spinners for some reason. I wish it said that the memory leak was because of the physics parts, would have saved me a ton of pain haha