How to make different variable names with a loop?

How could I make different variable names with a loop?
I’ve already tried using the two dots to convert it to a string.
How would I make this work, or is there an alternative?
For example:

for 1,5,1 do
var1 = Instance.new(“Part”)
end
For the second time it runs:
for 1,5,1 do
var2 = Instance.new(“Part”)
end

No there isn’t, however you can use a table.

local parts = { }

for i = 1, 5 do
    local part = Instance.new("Part")
    part.Name = "Part" .. i
    parts["part" .. i] = part
end

print(parts.part3) -- Part3
3 Likes