Naming a dictionary key

table.insert(table, v)
However, this would mean table[1] = v.
Whereas I want table[v.Name] = v.

Is there a method of doing this without having to iterate through the dictionary again?

you can do

Table[v.Name] = v

returns:
image

I’ve tried something like this previously:

	for i,v in pairs(workspace:FindFirstChild("Folder"):GetDescendants()) do
		if v.Name == "Ex" then
			TableName[v.Parent.Name] = v.Parent
		end
	end

However, when I print the table, there’s nothing in it.

does it print table:random letters?
that script works fine, just that roblox table printing is weird

No, it only returns as {}

image

well then none of the stuff are named what you have it as. the table[thing here] = thing works fine. just the if statement

Looks like I had actually forgotten I changed the name of the parts I wanted to insert into the table, sorry!