Multiple variables to a path

Hi. Often times I see people set variables to a path. I wanted to know what these are used for
ex

local var, var2 = set path or function

also why does this only create one part?

local obj, obj2 = Instance.new("Part", workspace)

I get that i can do this

local obj, obj2 = Instance.new("Part", workspace), Instance.new("Part", workspace), 

though i swear ive seen two variables with only one path. Ty

they are probably creating the variable for later use

You’re only calling Instance.new once, so it looks like:

local obj = Instance.new("Part", workspace)
local obj2 = nil

Setting multiple variables at once can be for convenience or for situations where a function returns multiple values:

local function return_multiple_values()
   return 1, 2, 3;
end

local one, two, three = return_multiple_values();
print(one, two, three); --> 1 2 3
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.