how can i make a script that will pick a random map i make in my game
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!")
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")