So. I had this generation for a while and it kept stopping.
This is the code.
function Gen(Room,RoomTable,Finished)
Finished = false
repeat wait()
print("1a")
print("Restart")
if Finished == false then
wait()
print("2a")
Finished = false
local Count = 0
RoomTable = {}
local RandomLine = game.Workspace.Map:GetChildren() --Get Random Position
local i = RandomLine[math.random(1, #RandomLine)] --Get Random Line
wait()
if i.Special.Value == false then
print("3a")
for _,a in pairs(Room:GetChildren()) do
print("4a")
a.Finished.Value = false
if game.Workspace.Map:FindFirstChild("" .. convert2(i.Letter.Value + a.Ltr.Value) .. "-" ..tonumber(i.NumberText.SurfaceGui.TextLabel.Text)+ a.Num.Value) then --Get the Line where the room should be
print("5a")
if game.Workspace.Map:FindFirstChild("" .. convert2(i.Letter.Value + a.Ltr.Value) .. "-" ..tonumber(i.NumberText.SurfaceGui.TextLabel.Text)+ a.Num.Value).Special.Value == false then
print("6a")
print("FinishedTrue") --Print if it found
if a.Owner.Value == nil then --If it is the main
a.Owner.Value = i --Set the main to the Line
a:SetPrimaryPartCFrame(a.Owner.Value.PrimaryPart.CFrame) --Let it get the position
else
a.Owner.Value = game.Workspace.Map:FindFirstChild("" .. convert2(i.Letter.Value + a.Ltr.Value) .. "-" ..tonumber(i.NumberText.SurfaceGui.TextLabel.Text)+ a.Num.Value)
a:SetPrimaryPartCFrame(a.Owner.Value.PrimaryPart.CFrame) --Let it get the position from the neighbor
end
a.Finished.Value = true --Make it Finished
table.insert(RoomTable,a.Owner.Value.Name) --Add it
end
end
end
end
wait()
if #RoomTable >= #Room:GetChildren() then --If it is finished
for _,ac in pairs(Room:GetChildren()) do
if ac.Finished.Value == true then
Count += 1
print(RoomTable[Count])
if Count >= #RoomTable then
print(#RoomTable)
Finished = true
for _,acc in pairs(Room:GetChildren()) do
acc.Owner.Value.Special.Value = true
end
break
--Make the loop finished
end
end
end
end
end
until Finished == true
end
the output is
16:27:27.647 1a - Server - Loop:108
16:27:27.648 Restart - Server - Loop:109
16:27:27.683 2a - Server - Loop:112
16:27:27.715 3a - Server - Loop:120
16:27:27.715 4a - Server - Loop:122
16:27:27.749 5a - Server - Loop:125
16:27:27.782 6a - Server - Loop:127
16:27:27.783 FinishedTrue - Server - Loop:128
16:27:27.783 4a (x2) - Server - Loop:122
16:27:27.932 1a - Server - Loop:108
16:27:27.932 Restart - Server - Loop:109
16:27:27.965 2a - Server - Loop:112
16:27:27.998 3a - Server - Loop:120
16:27:27.998 4a - Server - Loop:122
16:27:28.031 5a - Server - Loop:125
16:27:28.066 6a - Server - Loop:127
16:27:28.066 FinishedTrue - Server - Loop:128
16:27:28.098 4a (x2) - Server - Loop:122
16:27:28.231 1a - Server - Loop:108
16:27:28.231 Restart - Server - Loop:109
16:27:28.264 2a - Server - Loop:112
16:27:28.298 3a - Server - Loop:120
16:27:28.298 4a - Server - Loop:122
16:27:28.331 5a - Server - Loop:125
16:27:28.364 6a - Server - Loop:127
16:27:28.365 FinishedTrue - Server - Loop:128
16:27:28.399 4a - Server - Loop:122
16:27:28.432 5a - Server - Loop:125
16:27:28.465 6a - Server - Loop:127
16:27:28.465 FinishedTrue - Server - Loop:128
16:27:28.499 4a - Server - Loop:122
It stops when it doesnt find the other source Ive tried everything, from searching all forums to rewriting the script more than I should.