"Linking" a bunch of parts via script

Hello, I want to “link” a bunch of parts together. Basically what I mean is there are a bunch of parts in a folder. I want to make a for loop that will make a StringValue in the item selected in the loop.
I want the StringValue’s value to be the name of the previous item in the for loop. How could I do this?

I tried this code:

for i, v in pairs(workspace.Map.Borders:GetChildren()) do
		local LastName = "string"
		v.Name = ("Section"..i)
		LastName = v.Name
		
		if not (i % 2) then
			print(LastName)
			local Link = Instance.new("StringValue", v)
			Link.Name = (v.Name.."'s Link")
			Link.Value = LastName
			LastName = v.Name
			print(Link.Value)
		end
	end

But there were 2 problems:

  1. It doesn’t really use the last name in the loop
  2. The first item in the loop doesn’t work, since there isn’t anything behind it, and I guess the % function doesn’t work in Luau.

Any support is greatly appreciated, thank you!