It’s not really clear how your project is set up. Can you explain it better or post a screenshot of the Explorer window, showing exactly how the “Follow” parts and Last-/NextNode objects are laid out?
Generating Script (Old script which only generates a circle):
local SerStorage = game:GetService("ServerStorage")
local node = SerStorage.Node
local circleTable = {
500
}
for k, r in ipairs(circleTable) do
local offset = (k - 1) * 50
--print(offset)
for i = 1 + offset, 50 + offset do
print(i)
local newNode = node:Clone()
local angle = CFrame.Angles(0, i * math.pi/25,0)
newNode.CFrame = CFrame.Angles(0, i * math.pi/25,0) * CFrame.new(0,0,r)
newNode.Name = tostring(i)
local len = r * math.pi/25
newNode.Size = Vector3.new(len, 1, 1)
local node0 = Instance.new("Attachment") do
node0.Position = Vector3.new(-len/2, 0, 0)
node0.Name = "Node0"
node0.Parent = newNode
end
local node1 = Instance.new("Attachment") do
node1.Position = Vector3.new(len/2, 0, 0)
node1.Name = "Node1"
node1.Parent = newNode
end
local ntype = Instance.new("StringValue") do
ntype.Parent = newNode
ntype.Value = "Simple"
ntype.Name = "Type"
end
local order = Instance.new("IntValue") do
order.Parent = newNode
order.Value = i
order.Name = "Order"
end
newNode.Parent = workspace.Nodes
end
end
for i = 1,#workspace.Nodes:GetChildren() do
local lastI = tostring((i - 2)%50 + 1)
local nextI = tostring(i%50 + 1)
local I = tostring(i)
local current = workspace.Nodes[I]
local lastFolder = Instance.new("Folder") do
local part = workspace.Nodes[tostring(lastI)]
local val = Instance.new("ObjectValue")
val.Value = part
val.Parent = lastFolder
lastFolder.Name = "LastNode"
lastFolder.Parent = current
end
local nextFolder = Instance.new("Folder") do
local part = workspace.Nodes[tostring(nextI)]
local val = Instance.new("ObjectValue")
val.Value = part
val.Parent = nextFolder
nextFolder.Name = "NextNode"
nextFolder.Parent = current
end
end