I have a scenario. Let's say I create an item (like assemble something using Instance.New, other cloning stuff, etc) as for a player request. Does it save more performance if I use it as a clone for the first player request and other player requests after its creation from the first player request or make it so for each creation to just use it on the player and delete it afterwards (Bassicly what im trying to say is, if the item does not exist it will create an item for that first player request and beyond OR create the item each time for different players, its not constant btw)?
#Need Opinion (Performant Based) on Question (In message):
1 messages · Page 1 of 1 (latest)
If its Virtually live[Lie-ve] in workspace it will use more performance because it is being visualized, cloning is like preparing while Instance.New is, I think also the same? Although it will use storage* if its not inside live virtual worlds.
what if created and placed in starterpack
It'll be stored as data
but in ur opinion
?
would it be better to create that lets say same item everytime or if the first time a player requests to use the item and that same item for the rest of the game if other players may request it
and i want it performant based not opinion based lol sorry
._.
?
well im gonna just stick to creating it once after first request and then use that item to clone to other players. If anyone thinks the other way is better PLEASE DO NOT HESITATE TO TELL ME. Or please gladly explain.
The other is better
explain please
if you’re asking if you should cache the clones then yes, that’ll likely be more performant than making new ones every-time
all you’d need to do is clone a couple and just set their CFrames to an extremely faraway distance and just update the values and CFrame upon player request, whenever the player is done with the clone reset the values to default and CFrame it away
one thing to note is that setting the .Parent property of instances is fairly expensive - avoid it when you can ideally
also it could be considered micro-optimization to cache the clones if these player requests are rather infrequent
distance matters if its on serverstorage lets say?
as in the cached object
you’d have them in workspace, CFramed farrr away - that’s what PartCache as mentioned by Nom does
Re-parenting an instance isn’t good for performance
ah i see
so make it so if the player requests the object clone it once and if the player needs it again use the cframe method right
so do i just paste that number for the cframe values?
k
yeah just make a new CFrame with those as the values
k thanks
also what if i were to put the object in like the player. would i still have to do the cframe thing or not neccerarily
if you use Instance.new then you have to assemble the properties first (only set parent once you done all assembling)
if you clone then it'll take some time to load
you can directly set the parent after the clone unless you have to set the property first
I'm not sure about the performant but I think it really depend your game