Answered by
8 years ago Edited 8 years ago
This seemed fun so I thought I'd answer it.
- I recommend you use the server storage for each of your maps.
- I recommend you use a folder called Maps
- I recommend your maps be grouped into a model.
- I recommend you clone the map and set its parent to the workspace to spawn it. It will spawn directly where you built it.
This script will be made with the above in mind.
01 | local storage = game:GetService( "ReplicatedStorage" ) |
03 | function SpawnMap(MapNum) |
04 | for _, Maps in pairs (storage:GetChildren()) do |
05 | local MapToSpawn = "Map" .. MapNum |
06 | if Maps.Name = = MapToSpawn then |
07 | Maps:Clone().Parent = workspace |
08 | local MapObjects = Maps:GetChildren() |
09 | for _, MapObject in pairs (MapObjects) do |
10 | if MapObject.Name = = "PlayerStartDoor" then |
11 | local PlayerStartDoor = MapObject |
12 | PlayerStartDoor.Lock = true |
This scripts spawn a map of your choosing.
SpawnMap(1)
This will spawn Map1
when Map1 spawns the script will look for the door and lock it.
Loops are fun.