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

Changing Maps

I have a project and I want it to change maps, I already have more than 5. I know how when you put it in Lighting I got that part, Put the scripting I need help with. Not that I'm saying I want you to script it I just need help

1 answer

What I would do, is store the maps in a model named Maps in server storage, and then use this code to access them.

maps = game.ServerStorage.Maps:GetChildren()

function loadMap(map)
	table.foreach(Workspace.currentMap:GetChildren(), function(i,v) v:Remove() end)--remove children
	nmap = map:Clone()
	nmap.Parent = game.Workspace.currentMap
	nmap:MoveTo(Workspace.mapLocation)
end

function randMap()
	loadMap(maps[math.random(1,#maps)])
end

These are the objects you would need for this code to work.

A model in Workspace called currentMap A model in ServerStorage called Maps

I hope this helps.

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