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

Changing Maps [closed]

Asked by 10 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
10 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.

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.

Ad