Theoretically, which one would lag more?

Simple question:

Let’s say that you wanted to make something, in this case, lots of things. They could be UI’s or simple buildings.



Which one would be better?:

Cloning the UI/Building from Server/Replicated Storage

OR

Making the UI/Building from instances


But, here’s the catch:

The buildings/UI are random but predictable

This means that you can theoretically instance all the needed parts from a script.


Pros for instancing:
Less memory is taken up by things in the server storage

Cons for instancing:
High chance of lag for low-end players (because there would be a lot of calculations involved)

Pros for Cloning:
Lower chance of lag for low-end players (the only 2 things needed is Cloning, then positioning)

Cons for cloning:
Big amounts of memory are taken up (20+ things with 10 - 30 parts in the Server/Replicated Storage)



Which one would theoretically be better? Cloning or instancing?

  • Cloning
  • Instancing

0 voters

Thank you for reading, suggestions are greatly appreciated.

1 Like

Hello TOP_Crundee123,
I would like to give an explanation of why instancing would be best optimise wise in the following statements.

If you are to use cloning this requires deplucation of a model, if this is a large model it will use a lot of memory to run this process, whilst with instancing even though It may take longer to program, it uses less memory to create a duplicate as it is creating the model from scratch via script.

Instancing can also be helpful as if you define the variable you can always use it again to define lets say a Touched event.

May I remind you, you can add a wait onto your script which will help low-end players from lagging out.

Hope this helped! :smiley:

1 Like

Client side or server side?

If the server is doing it, I’d put it all in ServerStorage and clone.

If the client is doing it, then depending on how much stuff you have I’d be wary of putting it all in ReplicatedStorage as you don’t know the memory limit of each client you’re ever gonna get.

How often is this occurring? Would you clone once and that’s it for the game? Or is this linked to movement? Or is it based on a fixed time step?

You can’t ask a question about lag without this info.

1 Like

There are too many parameters that need to be filled in my opinion. Server or client? When are said objects supposed to be instanced/cloned? Under what conditions and etc. Personally, for UI I’d instance but if it is a building, I’d clone them. Although this is just a preference and my ignorance towards optimisation and performance hehe.

1 Like

It occurs less and less as time goes

@Ukendio @BanTech

It’s client sided

In that case, I’d always manually instance.