local Maps = {'Yellow','ZigZag','Sphere'}
local randomMap = math.random(1, #Maps)
for i,v in pairs(Maps) do
if randomMap == i then
local storage = game:GetService("ReplicatedStorage")
local map = storage.Maps:WaitForChild(v):clone()
map.Parent = workspace.MapPlaying
✓ ANSWER ACCEPTED
How Can I Print The Map That has been Chosen?
2 answers
✓ Accepted answer
Try doing
if randomMap == [1] then
print("Yellow")
elseif randomMap == [2] then
print("ZigZag")
elseif randomMap == [3] then
print("Sphere")
end
First, create a folder and then after that put all of the maps in their. Make sure to place the folder in ServerStorage. Then, name the folder "Maps"
local MapList = game:GetService("ServerStorage").Maps:GetChildren() --Creates a table of the maps
local Index = math.random(1,#MapList) --Chooses a random map and then turns it into a number
local ChosenMap = MapList[Index]:Clone() --Find it in the table and clones it
ChosenMap.Parent = workspace.MapPlaying --Makes the parent into workspace.MapPlaying
print("Map Chosen: ", ChosenMap.Name) --Prints it.
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
If thats does not work try replacing the [1] [2] [3] with 1 2 3
Thank You, Second method works!
np
Don't ever use a string key in a comparison. Why would you even want to do that?