Instance.new() or manually adding a part?

Let’s say that you want to parent a Part to a character.

Two options come to your mind:

(LocalScript under StarterCharacterScripts.) (Yes, I want it to be local; if done by a script.)

  1. local starterCharacter = script.Parent -- Accessing the character.
    
    local part = Instance.new('Part') -- Creating a part.
    
    part.Parent = starterCharacter -- Parenting it to our character.
    

The code above is relatively easy to write - requires very little knowledge of Roblox’s API and Lua.

(No scripting involved.)

  1. This method is done by making a custom character (or grabbing a dummy/rig) and inserting it into StarterPlayer by the name of StarterCharacter. Afterwards we manually add a Part by clicking the + icon (which shows up next to the StarterCharacter after hovering over it) and finally, if we play the game the result will be the same as the first option: having a Part parented to your character.

Now, here’s my question: Which one is better?

It would be much more convenient to use Instance.new here.

You could use Instance.new() if you want to add a part during the game time

Well it depends on the circumstance. As @DasKairo already said, it would make little to no sense in this situation to create an entirely new character just to insert a random part.
But, if we’re talking about adding new motor6ds, welds, or anything that is needed for your character to work properly, it’s usually preferable to create a custom character and use a HumanoidDescription to import the player’s custom avatar assets if needed.

In general, it is usually better to use the first option of parenting a Part to a character through a script, rather than manually adding it through the Roblox Studio interface. Here are some reasons why:

  1. Automation and scalability: When you use a script to parent a Part to a character, you can easily duplicate and reuse the script across multiple characters without having to manually add the Part each time. This can be particularly helpful if you have many characters that need to have the same Part attached to them.
  2. Efficiency: Using a script can be more efficient in terms of time and effort. Manually adding the Part through the interface can be a bit tedious and time-consuming, especially if you have to do it repeatedly for many characters.
  3. Flexibility and customization: By using a script, you have more control over the process and can customize it to your specific needs. For example, you can add conditions to the script so that the Part only gets added to certain characters based on certain criteria.

That being said, there may be situations where manually adding the Part through the interface makes more sense, particularly if you only need to do it once or twice and don’t want to bother with scripting. Ultimately, the best approach depends on the specific needs of your project.

this is definitely A.I generated bro :skull: :skull:

1 Like

Yea I am bad at communication so yes it is. But I do scripting and such myself. (Reason is because I am german, I hope that explains it (I ain’t that good at english))

1 Like

I suggest you try and use a translator instead, don’t worry if there’s some mistakes, we all know the translator isn’t perfect and there’s a lot of people that don’t talk English :wink:

Alrighty, I will try that, thanks!

1 Like

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