Allow defining the Parent of an object as an argument of `:Clone()`

As a Roblox developer, every time I want to clone an object, I have to create 2 lines:

MyObject:Clone()
MyObject:Parent = workspace

But with Instance.new() I can create and parent the new object in the same line:

MyObject = Instance.new("Part", workspace)

It would be great to have a single line for Clone, mentioning the Parent as an argument, like this:

MyObject:Clone(workspace)

If Roblox is able to address this issue, it will avoid redundant lines, reducing the size of the script, and making it clearer and more intuitive.

2 Likes

Related:

Part of Roblox’ API design philosophy is to not make pure “helper” methods like this as part of the core API: methods should either exist because they expose completely new functionality that didn’t exist before, or expose a more performant way to do something which was technically possible before but unacceptably costly performance wise.

As for why Instance.new with a parent argument exists currently: This was a bad idea, the Parent argument would not have been added if the API were designed today.

20 Likes

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