I am trying to make a random map system, and I have made a script like this before, but it was a bit more complicated, with teams and a lobby. But this one I want to be extremely simple, and for it to instantly teleport people from map to map. I have my code down below here:
local players = game:GetService("Players") local replicated = game:GetService("ServerStorage") local mapsFolder = replicated.Maps local maps = mapsFolder:GetChildren() while true do local randomMap = maps[math.random(#maps)]:Clone() local message1 = Instance.new("Message") message1.Parent = workspace message1.Text = "The next map will be... "..randomMap.Name.."!" randomMap.Name = "Map" randomMap.Parent = workspace for _, player in ipairs(players:GetPlayers()) do player.Character.Torso.CFrame = workspace.Map.SpawnLocation.CFrame player:LoadCharacter() end task.wait(2) message1:Destroy() local hint2 = Instance.new("Hint") hint2.Parent = workspace for i = 300, 0, -1 do hint2.Text = ("Next map in: "..i) task.wait(1) end hint2:Destroy() local currentMap = workspace:FindFirstChild("Map") if currentMap then currentMap:Destroy() end end
@Forummer? You know a lot so maybe you can help.