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

How to make a change map script to random map? [closed]

Asked by 8 years ago

How would I make a change map script that changes map randomly? Like, I made 4 different maps, I want it to make 3 disappear and 1 appear and you spawn on it and play for 3 minutes, than change to a random map?

Closed as Not Constructive by alphawolvess and M39a9am3R

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

2 answers

Log in to vote
0
Answered by 8 years ago
Edited 8 years ago

You can generate the map into a folder in roblox and move the folders in and out of the ServerStorageService.

Objects moved there will stay in the position but do not exist in the Workspace so cannot be interacted.

I am guessing you are generating all four and switching them out every 3 minuits so each folder can be moved like this

local Map1 = Workspace.Map1--Map1 is the name of the folder you stored map1
local Map2 = Workspace.Map2--Map2 is the name of the folder you stored map2
local Map3 = Workspace.Map3--Map3 is the name of the folder you stored map3
local Map4 = Workspace.Map4--Map4 is the name of the folder you stored map4

Map2.Parent = game.ServerStorage
Map3.Parent = game.ServerStorage
Map4.Parent = game.ServerStorage

wait(180)

Map1.Parent = game.ServerStorage
Map2.Parent = game.Workspace

wait(180)

Map2.Parent = game.ServerStorage
Map3.Parent = game.Workspace

wait(180)

Map3.Parent = game.ServerStorage
Map4.Parent = game.Workspace
0
Paste the folders into ServerScriptService, or ServerStorage? PhireNight -2 — 8y
0
While this may work it won't fit the criteria of a map changing script in a mini-game.... yougottols1 420 — 8y
Ad
Log in to vote
0
Answered by
camxd01 48
8 years ago

Next time, put an attempt at the script first so you don't get flagged. But this is the script. It's randomized as it can be.

Make a folder directly in Workspace called "MapHolder"

local Map1 = game.ServerStorage:FindFirstChild("1")--change the number to the map names, just copy and paste to add more.
local Map2 = game.ServerStorage:FindFirstChild("2")
local Map3 = game.ServerStorage:FindFirstChild("3")
local Map4 = game.ServerStorage:FindFirstChild("4")

local maps = {"1", "2", "3", "4"}--Add to this is you make another map
while true do
wait(1)
local newmap = math.random(1, #maps)

if newmap = 1 then 
Map1.Parent = game.Workspace.MapHolder
wait(180)
elseif newmap = 1 then 
Map2.Parent = game.Workspace.MapHolder
wait(180)
elseif newmap = 1 then 
Map3.Parent = game.Workspace.MapHolder
wait(180)
elseif newmap = 1 then 
Map4.Parent = game.Workspace.MapHolder
wait(180)
end
--Copy the 3 line above and replace the "Map4"  with your new map(probably Map5) to add another one. Delete the end inbetween.
game.Workspace.MapHolder:ClearAllChildren()
break 
end

Please accept if it helped, Ask questions too.

0
Why would you make a wait 180? What if the map 2-4 was chosen? The script looks like it will have to wait over 2 minutes to check. yougottols1 420 — 8y