Mass-Assigning Variables

I’m thinking that, in this instance, what you might be looking for is OOP: All about Object Oriented Programming

Otherwise, I believe there are multiple ways to construct a table to meet your needs. OssieNoMae suggested one above and here is a suggestion that I think is more in line with your requirements:

local variableTable = {
  {
    ["memberParts"] = {
      workspace.Part1,
      workspace.Part2,
      workspace.Part3,
    },
    ["Variable1"] = false,
    ["Variable2"] = 123,
    ["Variable3"] = "abcdefg",
  },
}

The downside to the above solution would be the time spent searching through the table and finding the subtable containing the part you want. This would require two for loops unfortunately.

1 Like