-- ========================================================= -- 🩶 STABLE FPS OPTIMIZER & GRAYSCALE (FIXED V2) 🩶 -- Engineered to avoid stutters, memory leaks, and frame drops. -- ========================================================= local Lighting = game:GetService("Lighting") local Workspace = game:GetService("Workspace") local SoundService = game:GetService("SoundService") local RunService = game:GetService("RunService") local StarterGui = game:GetService("StarterGui") local Players = game:GetService("Players") local LocalPlayer = Players.LocalPlayer print("[Optimizer] Initializing stable grayscale mode...") -- 1. FORCE LOW GRAPHICS (Wrapped in pcall for executor compatibility) pcall(function() settings().Rendering.QualityLevel = 1 settings().Rendering.MeshPartDetailLevel = Enum.MeshPartDetailLevel.Level01 end) -- 2. ACTUAL GRAYSCALE (Affects UI, Skybox, and Terrain) local colorCorrection = Lighting:FindFirstChild("TubersGray") or Instance.new("ColorCorrectionEffect") colorCorrection.Name = "TubersGray" colorCorrection.Saturation = -1 -- Completely removes color colorCorrection.Contrast = 0.1 colorCorrection.Brightness = 0.05 colorCorrection.Parent = Lighting -- Disable heavy lighting Lighting.GlobalShadows = false Lighting.EnvironmentDiffuseScale = 0 Lighting.EnvironmentSpecularScale = 0 Lighting.OutdoorAmbient = Color3.fromRGB(128, 128, 128) Lighting.ClockTime = 12 -- Remove post-processing for _, v in ipairs(Lighting:GetChildren()) do if v:IsA("PostEffect") and v ~= colorCorrection then v:Destroy() end end -- 3. TERRAIN OPTIMIZATION (Keeps ground solid, stops water lag) pcall(function() Workspace.Terrain.WaterWaveSize = 0 Workspace.Terrain.WaterWaveSpeed = 0 Workspace.Terrain.WaterReflectance = 0 Workspace.Terrain.Decoration = false end) -- ========================================================= -- 4. THE SAFE PROCESSING FUNCTION (No Destroying Meshes) -- ========================================================= local function optimizeVisuals(obj) pcall(function() -- Hide textures instead of destroying them (Can be toggled back) if obj:IsA("Decal") or obj:IsA("Texture") then obj.Transparency = 1 -- Disable PBR materials safely elseif obj:IsA("SurfaceAppearance") then obj.AlphaMode = Enum.SurfaceAppearanceAlphaMode.Opaque -- Flattens it without destroying -- Disable effects safely elseif obj:IsA("ParticleEmitter") or obj:IsA("Fire") or obj:IsA("Smoke") or obj:IsA("Trail") or obj:IsA("Beam") then obj.Enabled = false -- Disable dynamic lights elseif obj:IsA("PointLight") or obj:IsA("SpotLight") or obj:IsA("SurfaceLight") then obj.Enabled = false -- Gray out parts elseif obj:IsA("BasePart") then obj.CastShadow = false obj.Material = Enum.Material.SmoothPlastic obj.Reflectance = 0 obj.Color = Color3.fromRGB(130, 130, 130) end end) end -- 5. THE FIXED QUEUE SYSTEM (Replaces the fake debounce) -- Instead of processing 10,000 volcano parts in 1 frame, we queue them -- and process 50 per frame. This completely eliminates the crash/stutter. local processQueue = {} local isProcessing = false local function processQueueLoop() if isProcessing then return end isProcessing = true task.spawn(function() while #processQueue > 0 do local count = 0 -- Process 50 items at a time while #processQueue > 0 and count < 50 do local obj = table.remove(processQueue, 1) if obj and obj.Parent then optimizeVisuals(obj) end count = count + 1 end -- Wait for the next frame before doing the next batch RunService.Heartbeat:Wait() end isProcessing = false end) end -- Initial sweep (Queue everything currently in game) for _, v in ipairs(Workspace:GetDescendants()) do table.insert(processQueue, v) end processQueueLoop() -- Catch new objects and add to the queue Workspace.DescendantAdded:Connect(function(obj) table.insert(processQueue, obj) processQueueLoop() end) -- ========================================================= -- 6. SAFE TOGGLE UI (Turn it off without rejoining) -- ========================================================= local gui = Instance.new("ScreenGui") gui.Name = "OptimizerUI" gui.IgnoreGuiInset = true gui.DisplayOrder = 999 gui.Parent = LocalPlayer:WaitForChild("PlayerGui") local toggleBtn = Instance.new("TextButton") toggleBtn.Size = UDim2.new(0, 200, 0, 40) toggleBtn.Position = UDim2.new(0, 20, 0, 20) toggleBtn.BackgroundColor3 = Color3.fromRGB(30, 30, 30) toggleBtn.TextColor3 = Color3.fromRGB(0, 255, 100) toggleBtn.Font = Enum.Font.Code toggleBtn.TextSize = 16 toggleBtn.Text = "MODE: MAX FPS (ON)" toggleBtn.Parent = gui Instance.new("UICorner", toggleBtn).CornerRadius = UDim.new(0, 8) local isOn = true toggleBtn.MouseButton1Click:Connect(function() isOn = not isOn if isOn then toggleBtn.Text = "MODE: MAX FPS (ON)" toggleBtn.TextColor3 = Color3.fromRGB(0, 255, 100) colorCorrection.Saturation = -1 for _, v in ipairs(Workspace:GetDescendants()) do table.insert(processQueue, v) end processQueueLoop() else toggleBtn.Text = "MODE: NORMAL (OFF)" toggleBtn.TextColor3 = Color3.fromRGB(255, 100, 100) colorCorrection.Saturation = 0 -- Restore color -- Note: Restoring textures/materials perfectly would require saving their original state, -- which is too memory heavy. We just restore the color and stop optimizing new parts. end end) -- ========================================================= -- 7. ACCURATE FPS COUNTER -- ========================================================= local fpsLabel = Instance.new("TextLabel") fpsLabel.Size = UDim2.new(0, 200, 0, 30) fpsLabel.Position = UDim2.new(0, 20, 0, 70) fpsLabel.BackgroundTransparency = 1 fpsLabel.TextColor3 = Color3.fromRGB(255, 255, 255) fpsLabel.Font = Enum.Font.Code fpsLabel.TextSize = 18 fpsLabel.TextXAlignment = Enum.TextXAlignment.Left fpsLabel.Text = "FPS: Calculating..." fpsLabel.Parent = gui local frames = 0 local timeElapsed = 0 RunService.RenderStepped:Connect(function(dt) frames = frames + 1 timeElapsed = timeElapsed + dt if timeElapsed >= 0.5 then local fps = math.floor(frames / timeElapsed) -- Memory is read in KB by collectgarbage, dividing by 1024 gets MB local mem = math.floor(collectgarbage("count") / 1024) fpsLabel.Text = string.format("FPS: %d | Lua Mem: %d MB", fps, mem) frames = 0 timeElapsed = 0 end end) print("[Optimizer] Queue system active. Game should be stable.")