What I need to be able to do is get the children of an object and create/insert into a dictionary. For example, I want the end dictionary to be like...
Thing1Name = {
[thing1child] = thing1.Value
[thing1child2] = thing2.Value
}
What I need to be able to do is get the children of an object and create/insert into a dictionary. For example, I want the end dictionary to be like...
Thing1Name = {
[thing1child] = thing1.Value
[thing1child2] = thing2.Value
}
This is the general format for adding to a dictionary:
myDictonary[key] = value
if you wanted to add an an item to Thing1Name with the key "Part" and the value game.Workspace.Part, then you'd say:
Thing1Name["Part"] = game.Workspace.Part
I'm guessing you're trying to save a bunch of object values into a dictionary.
Let's say we had a setup like this in the workspace.
to put all those values into a table we'd say:
local myDictionary = {}
for _, child in pairs(game.Workspace.Data:GetChildren())do
myDictionary[child.Name] = child.Value
end
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
You alright?