Is cloning network efficient?

  1. What do you want to achieve?
    I want to know if :Clone() will reduce network traffic over constructing an instance of an object through a server script.

  2. What is the issue?
    I’m just unsure because there’s no clear documentation on the api.

  3. What solutions have you tried so far?
    Googled, asked Bing AI, and checked the api.

This is kind of an edge case. But I have a server script that is creating particle emitters for each player. There’s so many attributes like gradients and stuff. And I thought that it was a lot of data to send out for each player each time a player spawns. So I’m wondering if :Clone() would somehow reduce network traffic since referencing an instance in replicated storage would take a lot less data. However I don’t know if the engine is set up that way.

Thanks if anyone has any idea.

1 Like

Cloning would be more efficient. Creating an object such as a particle emitter by using Instance.new() would make the server lag if done many times. Cloning wouldn’t make a major difference as it still creates an instance, but it’s still more efficient. If you wanted to make the server lag as least as possible, then you can use a module called PartCache which basically clones an instance that you provide beforehand. That way, you can call for one of the cloned parts and don’t have to create a new instance. Even if the server lags for a second, it’d be better for it to lag once than have it lag many times.

1 Like

Why don’t you just re-use the same particle instance instead of cloning or creating a new one.

Player dies → parent the particle/effects in replicatedStorage → once the player spawns again → re-add the particle (just re-assign any attachments, etc).

Would be more efficient than constantly creating/cloning and destroying instances. Also if you aren’t already. Why not just handle particles on the client instead of the server (if you aren’t already)? I’m assuming this isn’t some game-changing feature and just a simple effect.

Simply, store what particle a player currently has as an attribute/stringvalue, etc → players client reads that value → and add’s the effect to the other other players (as well as himself) → use a .Changed connection if a player changes effects → and you can detect when players die from the client as well and do the above.

That’s probably the most optimal solution I can think of right now.

1 Like

Hmm you bring up a good point. The most effective way of handling particle emitters is to have each client generate them. I do have a system that allows each local client to toggle the emitters. Took forever to make :tired_face:

For whatever reason I never thought of creating the particle emitters locally @_@