Tycoon Lag || How to fix?

Hey there, fellow devs!

Sometimes in my tycoon, the server seems to hang for like 4-5 seconds, but when it resumes, my tycoon has spawned A LOT of those money bricks. Usually the spammed bricks would succesfully make their way to converter and get converted into money, however in some cases the conveyor can become blocked and the player wouldn’t be able to make cash anymore.

Is there any way to see what causes this lag.
The lag isn’t like this all the time, it’s just sudden.

1 Like

Does this happen when someone’s leaving the server? It’s pretty common for tycoons to lag then cus the kit’s spawning a ton of models all at once and is removing it at once.

It also depends on how big your tycoon is and also depends how you made your drop system. If it lags when someone leaves like Krunnie said you can’t do a lot about unless you know how to customize the tycoonkit

1 Like

Spawn them only on the client and in a limited amount. Maybe no more than 200 rendered blocks per client? The droppers (if thats what you are using) can run on the server and add to the players money as you wish but there really is no reason to have all those blocks in mass on the server like that. Allowing the clients to spawn and manage the spawned bricks allows you to have more control and to limit the amount that are shown.

If you are looking to find the source of the lag I’d recommend using the microprofiler aswell as looking at the scripts running in your f9 console.

One thing you could do is maybe put a very small wait time between the tycoons being respawned and removed, or maybe having the tycoon itself spawn in say, server or replicated storage away from the server/clients so it wouldn’t lag and would do its necessary functions away from where it could cause lag.

I mean we don’t know if the OP’s using a tycoon kit (which is very likely) and if he didn’t then how is his code structured.