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
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.
Closed as Not Constructive by User#24403, Gey4Jesus69, zblox164, and green271
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?