I recently read several posts on how one should not set the parent of an Instance in the second argument of Instance.new like so:
local part = Instance.new("Part", game.Workspace)
and was wondering: Do I need to set the CFrame of a model/part before parenting it to the workspace(note: the CFrame unable to be determined until the model/part is cloned.)? Is that even possible? Here is an example:
local serverStorage = game:GetService("ServerStorage") local cloneablePartClone = serverStorage.CloneablePart:Clone() cloneablePartClone.Parent = game.Workspace cloneablePartClone.CFrame = CFrame.new() -- whatever you get the point
Hope you guys can help. Thanks!
You should set the CFrame before you parent the object to workspace.
The reason for this - and why you should not use the Instance.new with the parent argument, is because when you parent the part to workspace, the part, and any changes made to it must render in the game. It takes a lot more time to make changes and render accordingly rather than to just make changes. If the parent of the part is nil, then the changes can be made in extremely little time because there is no rendering involved when the part is not in the workspace.
Therefore, you should make sure you set the parent of the part to workspace at the very end to reduce the time it takes to make changes to the part.