You could probably just index each of your arrays with the index already provided from default_bunker_materials:
for i, v in pairs(default_bunker_materials) do
local part = Instance.new("Part")
part.Name = v
-- new block:
part.CFrame = default_bunker_terrain_position[i]
part.Size = default_bunker_terrain_size[i]
part.Parent = terrain
end
If you are wondering why I left out the parent argument from your Instance.new("Part"):
If this works, why this works
Whenever you use an array, you are secretly indexing them with numbers starting from 1:
-- this
{"a", "b", "c"}
-- is the same as this
{
[1] = "a",
[2] = "b",
[3] = "c"
}
So this gives the i meaning in the for loop by giving you the number part on the left, which every other array has as well:
local array = {"a", "b", "c"}
local otherArray = {"x", "y", "z"}
for i, v in pairs(array) do
print(i, v)
end
--> 1 a
--> 2 b
--> 3 c
for i, v in pairs(array) do
print(otherArray[i])
end
--> x
--> y
--> z