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

How to find a random map, and select it as a variable? [closed]

Asked by 10 years ago

Alright so I've seen alot of people who can get a random map in their games, and print the name of this random map, and clone this random map into workspace. First how do you get the random map? Second, how do you select it? Third how would you be able to name it a variable so you could;

print("Map is "..MapName.."!")

Any help with this please, I'm a beginner at scripting.

0
You can put all of the map names into a table and then use 'MapName = math.random(1, #TABLENAME)' FearMeIAmLag 1161 — 10y

Closed as Not Constructive by Perci1 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?

1 answer

Log in to vote
0
Answered by
MrCss 0
10 years ago

local MapsLocation = game.Lighting:WaitForChild('Maps') -- or anything lol local maps = {} for _,v in pairs(MapsLocation:GetChildren()) do table.insert(maps, v.Name) end --Run ur script local selectMap = maps[math.random(1, #maps)] print('Map selected: ' .. selectMap)

0
This works perfectly :D I need reputation, how will I get? MrCss 0 — 10y
0
When someone upvotes your answer, or when the asker accepted it. Redbullusa 1580 — 10y
0
Can u upvote me pls :D MrCss 0 — 10y
Ad