Instance.new refers to parameter that doesn't exist and fails to mention deprecated parameter

Instance.new at the Instance data type index page does not mention the parent parameter as being deprecated (which it is, according to the old Wiki). It also refers to val instead of className:

It may also be a good idea to mention that parenting the Instance only after its properties have been properly assigned is better performance-wise:

2 Likes

As far as I know, it’s not deprecated, they just warn you about issues with using it.

Due to how Roblox handles property listeners, setting properties after parenting an object can cause performance issues. It would be in your best interest to avoid using this method. For more information, see this thread

Thread being the one you’ve posted, aka this
Source

3 Likes

You’ll notice two listed constructors on the old Wiki page that you provided. The one that has the parent argument is strikethroughed, indicating its deprecation (AFAIK).

It would have deprecated next to it if it was deprecated.

1 Like

I’ve updated the description of Instance.new to include the following performance warning:

It should be noted that a similar warning is given on the Instance.Parent property:

As @Legoracer has already pointed out, it isn’t technically deprecated. Such a designation has a specific tag in the API dump. The old wiki (which itself is deprecated, mind you) was also edited in October 2016 with the strikethrough, though no API happened to officially deprecate the second argument. In addition, the method itself isn’t the cause of performance issues, but rather how it is often misused. There are still some cases in which using the second argument is acceptable (for instance, when creating an object inside another object which has yet to be made a descendant of the DataModel).

11 Likes

cc @Dandystan to mark the above as the solution, since the documentation was solved by a member of the IX Team.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.