How to define multiple items

Hey there, I am new to scripting!

So, I know that you can define a single item by the code below…

local NAME = game.Workspace.Part1

Is there any way that you can define multiple items?

Thanks,
nygiants819

1 Like

There sure is!

It looks something like this:

local var1, varTwo = "one", 2
print(var1) --> one
print(varTwo) --> 2

You can either do:

local foo, doo = "foo", "doo"

or

local foodoo = {"foo", "doo"}

or if you are searching for instances inside of a model do:

local ModelChildren = Model:GetChildren()
1 Like

you can even technically define many items through a dictionary

  local container = 
  
  {
    object1 = workspace.part;
    object2 = workspace.part2;
  
  }

  print(container.object1.Name) --> part

define multiple objects in one line this way

  local a, b, c = "a", "b", "c"
2 Likes