Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do you make a map regeneration script?

So I am making a game where there is a house that you can destroy and explore. I am planning on making big maps with more than one house but it already lags if you destroy to much of the house. I have looked everywhere but there are only Model regen scripts, but if I just made my Buildings a model they would be almost impossible to work with. I am not a scripter I know a bit about scripts and mainly build so this is something that would probably easy for a scripter.

1 answer

It's best to learn scripting but here.

local map = script.Parent.Map
local parts = map:GetDescendants();
local clone = map:Clone();
clone.Parent = workspace
for i = 1, #parts do
   pcall(function()
   parts[i].Anchored = true;
   parts[i].CanCollide = false;
   parts[i].Transparency = 1;
   end)
end

To destroy the map, do clone:Destroy(); To rejen the map, do

local clone2 = map:Clone();
local parts2 = map:GetDescendants();
for i = 1, #parts2 do
   pcall(function()
   parts2[i].Anchored = true;
   parts2[i].CanCollide = true;
   parts2[i].Transparency = 0;
   end)
end

With a huge map, this may be laggy and potentially crash anybody with a bad pc.

This discussion is preserved as it was. New answers, comments, and votes are closed.