#Directory Name Problem

26 messages · Page 1 of 1 (latest)

sleek token
#

kind of hard to explain but I have (for example) a name of a part with Part.Name. The problem is that a few lines down I need to get a child of a folder that has the Part.Name's name and I have no idea how to do it.

Here is example code if it worked like this:

local myPartsName = workspace.Part.Name

local childOfFolder = workspace.myEpicFolder. -- myPartsName would go here but I need it to use the value of myPartsName not myPartsName itself.
scenic plover
#

do you mean you want to get the child with the name u got in "myPartsName"?

sleek token
#

yes

scenic plover
#

workspace.myEpicFolder[myPartsName]

#

or

#

workspace.myEpicFolder:FindFirstChild(myPartsName)

sleek token
#

ohh ok thanks

#

lemmie see if it works

#

ok so it works to an extent

#

when i print the result it gives [Instance(200B1EA9848)] = {} (im setting it to an empty table on purpose)

scenic plover
#

what u printed

sleek token
#

it should be myCoolPart = {}

scenic plover
#

thats the reference to your part tho

sleek token
#

im confused

#

wdym

scenic plover
#

being honest idk why that happens

#

but yeah that weird thing is your part

#

if u want to name u can do maybe

#

sum like that

sleek token
#

i can try

#

Ok yes it did work

scenic plover
#

so now to get the part u do

#

local part = table[yourPartName]

sleek token
scenic plover
#

and then u get the key