how can i make a script that will pick a random map i make in my game
✓ ANSWER ACCEPTED
Pick A Random Map
3 answers
✓ Accepted answer
Here ya go
Map1 = game.ServerStorage["Map"]
Map2 = game.ServerStorage["Map"]
Map3 = game.ServerStorage["Map"]
Maps = {Map1, Map2, Map3} --Make sure the maps are Objects
local randmap = math.random(1, #Maps)
print(Maps[randmap].Name .. " Has been picked!")
1 comment
0
This could be more efficient
Answer:
-- If you want no hints remove the lines ending in nohint
-- STUFF --
local h = Instance.new("Hint", Workspace) -- nohint
local findMaps = game.ServerStorage["Maps"]:GetChildren()
-- PICKING MAP --
local map = findMaps[math.random(#findMaps)]
print(map.Name.." has been chosen!")
h.Text = "map.Name.." has been chosen!"" -- nohint
-- LOADING MAP --
m = map.Clone()
m.Parent = Workspace
ServerStorage > Maps > Put all your maps in here.
local mapFolder = game.ServerStorage["Maps"]:GetChildren()
local map = mapFolder[math.random(#mapFolder)]
print(map.Name.. " chosen")
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
You need to provide more information than this. How are your maps implemented? Are they models stored in ServerStorage? Are they generated via a script? The answer will depend on what you mean by
map