This track should have more tracks in front of it which they keep being generated as you go further but the script only generate the first track and stops
local replicatedStorage = game:GetService("ReplicatedStorage")
local raceSection = replicatedStorage:WaitForChild("raceSection")
local map = workspace:WaitForChild("map")
-- Ensure 'race' folder exists under 'map'
local race = map:FindFirstChild("race")
if not race then
race = Instance.new("Folder")
race.Name = "race"
race.Parent = map
end
local stages = 0
local OldZPosition = 0
while stages < 1000 do
task.wait()
local newSection = raceSection:Clone()
newSection.Parent = race
if newSection:FindFirstChild("base") then
newSection.base.BrickColor = BrickColor.random()
end
local newZPosition = OldZPosition
for i, child in newSection:GetChildren() do
if child:IsA("BasePart") then
child.Position = child.Position + Vector3.new(0, 0, newZPosition)
end
end
OldZPosition = OldZPosition + 1000
stages = stages + 1
end```