Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Changing Maps [closed]

Asked by 11 years ago

This question already has an answer here:

Where can I get a 100% working changing map gui or script?

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

Marked as Duplicate by User#2

This question has been asked before, and already has an answer. If those answers do not fully address your question, then please ask a new question here.

Why was this question closed?

1 answer

Log in to vote
2
Answered by
Trewier 146
11 years ago

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

01maps = game.ServerStorage.Maps:GetChildren()
02 
03function loadMap(map)
04    table.foreach(Workspace.currentMap:GetChildren(), function(i,v) v:Remove() end)--remove children
05    nmap = map:Clone()
06    nmap.Parent = game.Workspace.currentMap
07    nmap:MoveTo(Workspace.mapLocation)
08end
09 
10function randMap()
11    loadMap(maps[math.random(1,#maps)])
12end

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.

Ad