I'm trying to rename 13 motors so that I can further script them to make a custom character. How would I change the names one by one, descending the list of children?
1 | local Body = script.Parent |
2 | Body.PrimaryPart = Body.HumanoidRootPart |
3 |
4 | for i = 1 , 13 do |
5 | local M = Instance.new( "Motor6D" ) |
6 | M.Parent = Body.Chest |
7 | end |
8 |
9 | local Z = Body.Chest:GetChildren() |
To give each motor a unique name, you must do this:
01 | local Body = script.Parent |
02 | Body.PrimaryPart = Body.HumanoidRootPart |
03 |
04 | for i = 1 , 13 do |
05 | local M = Instance.new( "Motor6D" ) |
06 | M.Parent = Body.Chest |
07 | M.Name = "Motor" .. i -- 'i' gets the number of loops |
08 | end |
09 |
10 | local Z = Body.Chest:GetChildren() |
This script will return a Motor named Motor then whatever id in the loop it is.
For example on the sixth loop, the Motor will be named "Motor6"
Sincerely,
jmanrock123
P.S. I HOPE THIS HELPED <3