Is there a way to get the name of a parts child?

Is there anyway to get a parts child name? With out using script.parent. blah blah blah, Is there way to get with :Getchildren? so like if a folder has 1 part then it will get the name of that part?

local f = game.Workspace.FolderWhoseChildrenYouWantTheNamesOf

for k, v in pairs(f:GetChildren()) do
  print(v.Name)
end

This prints the names of every child in f, is that what youā€™re asking for?

1 Like

Hi yes this is helpfull but is there anyway to turn it into a var?? so like

local folder = game.Workspace.Folder

local name = folder:getChildren().Name

also I should prob point out that the folder has only 1 child not like 500 or smth just 1, The reason i am doing this is beacuse the parts name will get changed and i dont know anyway of getting the new name of the part cause its name will be the players name

Iā€™d do something like folder:FindFIrstChildOfClass(ā€˜BasePartā€™)

1 Like

But how would i get the name of it?

You already got the child from the folder, so you just add ā€œ.Nameā€, to get the name.

1 Like

yeah sorry idk why i was so dumb in that moment LOL