I'm still learning how to use math.random, so could someone teach me how to use it, and when would be a good time to put the piece of code in a script?
maps = game.ServerStorage.Maps:GetChildren() -- put the maps in ServerStorage under a model named "Maps" mapselected = maps [math.random(1, #maps )] -- Chooses a random map map = mapselected:Clone() -- clones the map map.Parent = workspace -- sets the parent to workspace
Any Problems comment below. If I helped upvote me please...
I think you would first have an array of the maps you have. Then to get a random map, you would do math.random(1, #array), and then put the selected map into Workspace. So for instance:
myTable = {game.ServerStorage.Map1, game.ServerStorage.Map2, game.ServerStorage.Map3} -- [[I put the maps in ServerStorage]] mapselected = math.random(1, #myTable) --random map myTable[mapselected].Parent = Workspace -- put the selected map in Workspace
Something like that.