Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- this script was made by chatgpt and me with a few tweaks that are good
- local function optimizeGame()
- game:GetService("Workspace").StreamingEnabled = true -- Enable streaming to load parts dynamically
- for _, part in ipairs(game:GetService("Workspace"):GetDescendants()) do
- if part:IsA("BasePart") then
- part.Anchored = true -- Set all parts to be anchored for performance optimization
- end
- end
- game:GetService("RunService").RenderStepped:Connect(function()
- -- Limit the maximum number of parts visible in the workspace
- local visiblePartsLimit = 100 -- Adjust this value based on your game's needs
- local visiblePartsCount = 0
- for _, part in ipairs(game:GetService("Workspace"):GetDescendants()) do
- if part:IsA("BasePart") and part:IsInViewport() then
- visiblePartsCount = visiblePartsCount + 1
- if visiblePartsCount > visiblePartsLimit then
- part.Transparency = 999 -- Make parts transparent if they exceed the limit
- else
- part.Transparency = 0 -- Make parts visible if they are within the limit
- end
- end
- end
- end)
- end
- optimizeGame()
Advertisement
Advertisement