Unfortunately, I do not know specifically where the problem is because I have received 0 errors. The script isn't working as intended though. This script gets a random map and its spawn and then is supposed to teleport the player to their own individual spawn. This is based on a round system so intermission and game time. The problem I have noticed is that the Spawns aren't being chosen and that the players aren't being teleported. I have tried many things but this script isn't working. This script is shortened to its main things and should still work with the below because I do not want people to use it after the problem had been solved.
local Maps = script.Maps:GetChildren()
local Map
local function TimeHandler(Min, Max) -- Workings
for Index = Max, Min, -1 do
wait(1)
print(Index)
end
end
local function SpawnInSession(Spawn) -- Idk If it works. Might be the problem.
if Spawn.InSession == false then
Spawn.InSession = true
return true
else return false
end
end
local function Primary()
TimeHandler(0, 5)
Map = Maps[math.random(1, #Maps)]:Clone()
Map.Parent = game:GetService("Workspace") -- Works up to here.
local Spawns = Map.Spawns:GetChildren()
for Index, Player in pairs(game:GetService("Players"):GetChildren()) do
local Spawn = Spawns[math.random(1, #Spawns)]
while wait() and SpawnInSession(Spawn) == false do
Spawn = Spawns[math.random(1, #Spawns)]
SpawnInSession(Spawn)
end
local Character = Player.Character or Player.CharacterAdded:Wait();
Character.HumanoidRootPart.CFrame = Spawn.CFrame
end
end
Primary()

2 comments
150 reputation but not much knowledge how to make a question, are there any errors? Do you have any idea where the script could not be working? elaborate pls
Lol, I edited it so it should be easier to tell where the error is. I do not know specifically where the error/problem is because I received 0 errors in the output.