local LName = script.Parent["MapName"].Value
local Map = game.Workspace["Map"]
local Glass = game.Workspace["Glass"]:GetChildren()
local Spawn = game.Workspace.Glass["Spawn"]
local Door1 = game.Workspace["Door1"]
local Door2 = game.Workspace["Door2"]
script.Parent.Name = LName

script.Parent.MouseButton1Down:connect(function()
	script.Parent.Parent.Active = false
	script.Parent.Parent.Visible = false
	local test = Map:GetChildren()
	if #test >= 1 then
		game.Workspace["Map"]:ClearAllChildren()
	end
	local Players = game.Players:GetChildren()
	for i = 1, #Players do
		local x = math.random(-10, 10)
		local z = math.random(-10, 10)
		Players[i].Character:MoveTo(Vector3.new(Spawn.Position.x + x, Spawn.Position.y, Spawn.Position.z + z))
		wait()
	end
	for b = 1, #Glass do
		Glass[b].Transparency = 0.5
	end
	Door1.Transparency = 0
	Door2.Transparency = 0
	wait(1)
	Map:ClearAllChildren()
	local Maps = game.Lighting["Maps"]
	local Maps = game.Lighting["Maps"]
	local aav = Maps[LName]
	local Clone = aav:Clone()
	Clone.Parent = Map
	for b = 1, #Glass do
		Glass[b].Transparency = 0.5
	end
	local M = Instance.new("Message")
	M.Parent = game.Workspace
	M.Text = "Map Loaded."
	wait(5)
	M:Destroy()
end)

This is the code that runs in my specialized holo. I have rewritten it so many times trying to make it generalized but the code seems to tease me and not work D:

This code needs to be generalized so that all is required is a map change name. Keep in mind all maps will be in lighting. If you have any ideas please message me via here or in Roblox. Thanks for reading and double thanks if you help me. Can anyone help me?

1 comment

0

1 question for line 4 when you put Glass did you want it to be the variable above? If so put it in this [] Like so local Spawn = game.Workspace[Glass]["Spawn"] That may work. If not, sorry! If it does can you upvote one of my answers/questions on my profile?