Could this be better?

I made a simple map loading script for loading sections of a map so it can do wacky stuff, like going inside itself or not being able to see other parts of it through windows.

I wanted to know if this was a good way to do it? heres the script and video:

task.wait(3)

--This script is suppsoed to be flexible, and appliable to aother sections of the game

local Statuses = {
	Load1 = {"Sec3"},
	Load2 = {},
	Load3 = {"Sec1"},
	
	StartLoad = {"Sec3"} --The starting status of the map's loaded parts
}

local Sectors = {
	Sec1 = script.Parent.Parent.Sec1,
	Sec2 = script.Parent.Parent.Sec2,
	Sec3 = script.Parent.Parent.Sec3
}

local function Load(VName)
	for _, V in game.ServerStorage.Hideaway:GetChildren() do
		V.Parent = script.Parent.Parent
	end
	for _, V in Statuses[VName] do
		Sectors[V].Parent = game.ServerStorage.Hideaway
	end
end


for _, V in script.Parent:GetChildren() do
	if V:HasTag("LoadBlock") then
		V.Touched:Connect(function()
			Load(V.Name)
		end)
	end
end

Load("StartLoad") --ensuring that the map has its proper things loaded

This script works fine but i wanna know if theres better ways to do this

Or just set the window part Reflectance to 1 :smiley:

well using a script like this allows the map to collide in on itself, basically breaking reality. Althoguh ill use this for maps that dont need to do some stuff like that

Honestly it looks good. Besides the quick stutter when it spawns in, maybe you can add some visual effect to soften it up, so players don’t see the notice cut. Other than that it looks good!

You could always break it up into sections to soften the load, example checkpoint 1 spawns section A of the map then checkpoint 2 spawns section B e.t.c to just soften the load on the client.