Found this old post, has this been fixed? Or should I avoid this?
NO NO NO NO NO STOP RIGHT THERE.
dont start using Instance.new(âHighlightâ).Parent = workspace itâs goofy and stupid practice to ignore it!
firstof all it causes your performance to drop (stonks) and when you use Instance.new(âHighlightâ, workspace) itâs much better because it saves up more time.
Iâm doing this:
local mem3 = Instance.new("StringValue", newPartyEntry)
This is fine? Or no?
Hi, I wouldnât suggest using either. Why?
If you for example create a part, you would want to change the properties of it, before parenting it elsewhere.
local NewPart = Instance.new("Part")
NewPart.Name = "TestPart"
NewPart.Size = Vector3.new(1,1,1)
NewPart.Material = Enum.Material.Neon
NewPart.Position = Vector3.new(0,10,0)
NewPart.Parent = workspace
I personally like creating variables for new instances and setting properties before parenting.
Exactly, I donât know why anyone would create an instance just to parent to workspace and not create a variable.
No, just set the parent after youâve already defined the variable.
Thatâs bad practice though. Using Instance.new(âHighlightâ,workspace) is better while Instance.new(âHighlightâ).Parent = workspace wastes more time.Plus itâs a better way soo
Setting parent as the last thing for a new instance is the better choice. You wouldnât want the object to be present ingame, before setting the properties correctly first.
Sure. Or just use a.Parent. (i feel like im gonna get bombed with replies)
Explain how itâs a bad practice? Also just because itâs more lines to write does not mean itâs inferior. A perfect example is math.sqrt().
- Parent tech
- the (âthingâ,parent)
- Both
0 voters
again my second reply so devforum dosenât bomb me with their mods being crazy taking down my post.
just use both.they do the exact same thing (now plz stop bombing me with replies)
Why are you creating a poll? The OP could have just done that. Honesty you are making things more complicated.
For the most part, this is fine. Your simply instancing a stringvalue and parenting it, no property modifications.
The main problem from the thread is quick creation of many instances where you do work on modifying the properties, where once parenting the object, replication and tied event calculations will happen on that object whenever you set itâs properties, which will result in more work.
It depends on the instance your creating/amount/frequency of creation really,. A basepart has a trifold amount more properties/methodâs than a valuebase. So Using;
local stringVal = Instance.new("StringValue", workspace)
stringVal.Value = "jbafkyugbayd"
stringVal.Parent = game.ServerStorage
In comparison to setting sizeâs/cframeâs of parts has way less work for replication.
this is not âplace for devs to force and make devâs more sad and force the op to do thisâ forum. i am not making things more complicated, i think everyone is. Why are you gonna force someone to get off this forum?
i am this close to quitting the forum
Plus you cant change someones opinion fast
TLDR; Define the new instance with a variable, set properties (if needed), and then parent.
1 extra line for parenting will not impact anything to my knowledge.
Yea but I can still do that, itâs more about saving a slight bit of time. Iâm just wondering is there performance issues with that?
If youâre asking only if there is a performance difference, yea parenting last is best for that. There is a few specific cases, where you do not need to change properties of a new instance, these cases you can parent it right away with Instance.new(âObjectâ,parent)
Personally I think the âsaving timeâ argument is a bit thin. Compared to the amount of time you spend developing a proper game as a whole.
Yea but at the same time, the argument of how much time spending a proper game means you cut corners when it makes sense
I mean this does save time even minor as it may be.