Server script (in serverscriptservice):
local lobby_Duration = 10 local round_Duration = 10 local maps = game:GetService('ReplicatedStorage'):WaitForChild('Map'):GetChildren() local timerval = game.ReplicatedStorage:WaitForChild("TimerValue") local function RTimer () while wait() do for l = lobby_Duration, 0, -1 do timerval.Value = 'Intermission: '..l wait(1) if l == 0 then local map = maps[math.random(#maps, 1)] -- change to your map name timerval.Value = 'Teleporting players to '..map.Name wait(1) map.Parent = workspace local players = game.Players:GetChildren() for i = 1, #players do players[i].Character:MoveTo(Vector3.new(-122.5, 55.5, -41.5)) end wait(1) for g = round_Duration,0, -1 do timerval.Value = 'Round '..g..' seconds left' wait(1) if g == 0 then timerval.Value = 'Round over' wait(2) timerval.Value = 'Teleporting players to lobby' wait(1) for i = 1, #players do players[i].Character:MoveTo(Vector3.new(-122.5, 55.5, 2.5)) end map.Parent = maps wait(1) -- repeat again end end end end end end spawn(RTimer)
The reason for this is on the line where you choose a random map, math.random should have a min argument that is lesser than the max argument, you are doing the opposite, that's why it's not choosing a map and returning nil, the fix would probably be to swap the two values
if l == 0 then local map = maps[math.random(1, #maps)] -- this is the problem nametimerval.Value = 'Teleporting players to '..map.Name -- Your code