Could you tell me if this line of script could work and teleport all players to a random map, but not teleport them to different maps in the same round?
local coords1 = {Vector3.new(1,1,1), Vector3.new(1,1,2)} --example local coords2 = {Vector3.new(2,2,2), Vector3.new(2,2,3)} local coords3 = {Vector3.new(3,3,3), Vector3.new(3,3,4)} local map1 = coords1[math.random(#coords1)] local map2 = coords2[math.random(#coords2)] local map3 = coords3[math.random(#coords3)] local randMap = map1,map2,map3[math.random(map1,map2,map3)] for i,v in pairs(game.Players:GetPlayers()) do v.Character:MoveTo(randMap) end
Would that choose a random map and spawn them at random coordinates and all of them go to the same map or not?
If it wouldn't can you tell me how I would make it choose a random map and random coords and spawn players at the same map?
I don't think you're picking a random map the right way. If you want to clone a map and add it to Workspace, you can do this:
local maps = { --table containing all the maps located in ServerStorage game.ServerStorage.Map1:clone(), game.ServerStorage.Map2:clone() } function pickMap() return maps[math.random(#maps)]:clone() end local map = pickMap() --this returns a new map that you can parent to Workspace. map.Parent = Workspace --set the parent to Workspace --Now you need to teleport all players to a random position. To do this, I put a model inside each map called 'teleportParts'. It contains multiple parts. Each player will be teleported to a random part inside the teleportParts model. NOTE: The number of parts in teleportParts must be greater than the number of players local tParts = map.teleportParts:GetChildren() local players = game.Players:GetPlayers() for i, part in pairs(tParts) do player[i].Character:MoveTo(part.Position) --move each player to a different part end