Game getting slow

So I’m making this story game which is completed and is supposed to release in less than 1 hour and the game has this 1 thing in it.

The game just starts to slow down for literally no reason! I’ve tried to ask 6 professional scripters but none of them are able to find out why… The script is PERFECTLY fine and it’s 100% working. The game just starts to slow down at a random point and this only happens when there are 2 or more people in the game.

The game is just working fine and suddenly at some point where it’s supposed to wait for 1 second and then continue the next line of code, it waits like 20-30 seconds on that single thing! Like I put wait(1) and it behaves like wait(30).

This happens like 90% of the time and happens only if there are 2+ players in the server, any idea how to fix it? My game has less than 1 hour to release and I’m stuck on this since yesterday!

Any help would be highly appreciated! :pray:

1 Like

I think there is a problem with the code.

  1. Overuse of infinite loops
  2. Memory leak

I think there are other problems as well.

1 Like

What do you mean by ‘Memory leak’ exactly?

1 Like

Perhaps you aren’t disconnecting connections that ideally should be; given that they aren’t going to be destroyed. You can do a bit of debugging within your console. Check the activity rates and performance of the scripts.

I don’t think it’s a memory leak problem because it does not happen when there is only 1 player per server…

I also did a thing where if you teleport to a place from the town which you don’t need anymore, then the whole town including all the parts, folders, scripts in that town are Destroyed… The game is then left with like under 2k parts but it still slows down…

If one player leak memory one time, two players will leak two time.

If this were once a minute, it would leak twice as fast as one player.

Hey, do you think you could help me out with this a bit? If you could, I’d highly appreciate and I could pay you some in return too. If you are down to help, please DM me at Eco Crash#1000 :pray:

It used to happen when the lightning bolt hit, then it just stopped and starts happening at a new place, always that place now, we deleted all of the map apart from the part that was needed, but it didn’t change anything!

I think the reason the game is slowing down is because of too many parts, You should group the whole game together, and that should fix it. :slight_smile:

That wouldn’t cause the game to slow down as the game goes on, rather start out slow.

(this is the 5th time that I answer a topic like this, hmmm…)
Anyway here are some solutions that you can apply to your game:

  1. Remove the terrain that you don’t see
  2. Enable streaming (for more informations Content streaming )
  3. Disable Cast Shadows in the parts that doesn’t need shadows
  4. Optimize your scripts
  5. Use meshes (how to create a mesh from a building you did in studio meshes )
  6. Optimise the collions box (for other building tips here )
  7. Remove Can Collide to parts that you can’t touch

You can have some viruses some make sure that any script have a require() function unless you know what it requires; search for backdoors too!
It can be a plugin too!

(Another thing you can do is to open the Game Explorer tab, and delete images, assets… that you don’t use)

Hope it helps :slightly_smiling_face:
PS: Sorry for the bad English

1 Like

Use the view tab and click performance and performance scripts then press play to see where your performance issues is at…