-- Optimized Invisible Wall Remover (No Character Reload) local Players = game:GetService("Players") local Workspace = game:GetService("Workspace") local StarterGui = game:GetService("StarterGui") local UserInputService = game:GetService("UserInputService") local storedParts = {} local processedParts = {} local isProcessing = false -- Store in global so it can be unloaded later _G.InvisWallStoredParts = storedParts _G.InvisWallConnections = {} local repairKeywords = { "stair", "step", "ramp", "trimp", "platform", "invisibleplatform", "floor", "ground", "pad", "road", "path", "bridge" } local function isGameplayPart(name) name = string.lower(name) for _, keyword in pairs(repairKeywords) do if string.find(name, keyword, 1, true) then return true end end return false end local function destroyAndStore() if isProcessing then return 0, 0 end isProcessing = true local destroyedCount = 0 local storedCount = 0 local parts = {} -- Batch collect parts for _, obj in pairs(Workspace:GetDescendants()) do if (obj:IsA("BasePart") or obj:IsA("MeshPart")) and not processedParts[obj] then table.insert(parts, obj) end end -- Process in chunks local chunkSize = 50 for i = 1, #parts, chunkSize do for j = i, math.min(i + chunkSize - 1, #parts) do local obj = parts[j] if obj and obj.Parent then local name = string.lower(obj.Name) if isGameplayPart(name) then if obj.CanCollide then local newPart = obj:Clone() newPart.Parent = nil table.insert(storedParts, newPart) pcall(function() obj:Destroy() end) storedCount = storedCount + 1 end else if obj.CanCollide and obj.Transparency >= 0.8 and obj.Position.Y > 50 then pcall(function() obj:Destroy() destroyedCount = destroyedCount + 1 end) end end processedParts[obj] = true end end task.wait() end isProcessing = false return storedCount, destroyedCount end local function restoreStoredParts() local restoredCount = 0 local mapParent = Workspace:FindFirstChild("Map") or Workspace:FindFirstChild("Level") or Workspace -- Restore in chunks local chunkSize = 25 for i = 1, #storedParts, chunkSize do for j = i, math.min(i + chunkSize - 1, #storedParts) do local part = storedParts[j] if part then pcall(function() part.Parent = mapParent restoredCount = restoredCount + 1 end) end end task.wait() end storedParts = {} processedParts = {} return restoredCount end local function runCleanAndFix() local stored, destroyed = destroyAndStore() task.wait(0.2) local restored = restoreStoredParts() if destroyed > 0 or restored > 0 then StarterGui:SetCore("SendNotification", { Title = "MAP REGENERATION", Text = string.format("Ramps: %d | Walls: %d | Restored: %d", stored, destroyed, restored), Duration = 5 }) else StarterGui:SetCore("SendNotification", { Title = "CLEAN", Text = "No issues found", Duration = 3 }) end end local function runRefresh() if #storedParts > 0 then local restored = restoreStoredParts() StarterGui:SetCore("SendNotification", { Title = "Map Refresh", Text = string.format("Restored %d parts", restored), Duration = 3 }) end runCleanAndFix() end local inputConn = UserInputService.InputBegan:Connect(function(input, gameProcessed) if gameProcessed then return end if input.KeyCode == Enum.KeyCode.J then runRefresh() end end) table.insert(_G.InvisWallConnections, inputConn) task.wait(1) runCleanAndFix() StarterGui:SetCore("SendNotification", { Title = "Wall Remover Active", Text = "Press J to refresh map", Duration = 5 })