-- Rebuild the map with a BUSTED require() cache. -- -- PITFALL (cost a build cycle on 2026-08-02): require() caches per Studio -- session and keyed by INSTANCE. Pushing new .Source into the existing -- ModuleScript does NOT invalidate that cache, so `require(MapBuilder)` -- happily returns the OLD compiled module and the map rebuilds from stale -- code -- the diagnostic then reports failures that the source has already -- fixed (legacy PARingPillar present, no ramp segments). -- -- Fix: swap in CLONES. A clone is a different instance, so it misses the -- cache and is compiled fresh. Circuit must be swapped too, because -- MapBuilder resolves it BY PATH -- putting the clone at the same path is -- what makes the fresh MapBuilder pick up the fresh Circuit. local SSS = game:GetService("ServerScriptService") local RS = game:GetService("ReplicatedStorage") local mbOrig = SSS.Server.MapBuilder local ciOrig = RS.Shared.Circuit -- Clone both, park the originals under a holder so the paths are free. local holder = game:GetService("ServerStorage"):FindFirstChild("_cachebust") if holder then holder:Destroy() end holder = Instance.new("Folder") holder.Name = "_cachebust" holder.Parent = game:GetService("ServerStorage") local ciClone = ciOrig:Clone() local mbClone = mbOrig:Clone() ciOrig.Parent = holder ciOrig.Name = "Circuit_old" mbOrig.Parent = holder mbOrig.Name = "MapBuilder_old" ciClone.Name = "Circuit" ciClone.Parent = RS.Shared mbClone.Name = "MapBuilder" mbClone.Parent = SSS.Server local out = {} local function say(s) table.insert(out, s) end say("swapped in fresh clones (require cache bypassed)") local old = workspace:FindFirstChild("Map") or workspace:FindFirstChild("Circuit") if old then old:Destroy() say("destroyed previous Map") end local ok, err = pcall(function() local MB = require(mbClone) MB.build() end) if not ok then say("BUILD_ERROR: " .. tostring(err)) return table.concat(out, "\n") end local m = workspace:FindFirstChild("Map") or workspace:FindFirstChild("Circuit") local n = 0 if m then n = #m:GetDescendants() end say("BUILD_OK parts=" .. tostring(n)) -- Quick confirmation that the NEW code path actually ran. local counts = { PARingPillar = 0, PAEntryRamp = 0, PAExitRamp = 0, PARampPillar = 0, PARampKerb = 0 } for _, d in ipairs(workspace:GetDescendants()) do for k in pairs(counts) do if string.sub(d.Name, 1, #k) == k then counts[k] += 1 end end end for k, v in pairs(counts) do say((" %-14s %d"):format(k, v)) end return table.concat(out, "\n")