function PlayerManager.preparePlayers()local l=mapManager.getMap()if not l then return end local u=mapManager.getSpawnLocations()if not u then return end local V=u:GetChildren()local p=Players:GetChildren()for l,u in pairs(p)do table.insert(activePlayers,u)local p=V[1]table.remove(V,1)readyPlayer(u,p)local n=u.Character local h=n:FindFirstChild("\072\117\109\097\110\111\105\100")if h then h.WalkSpeed=gameSettings.roundWalkSpeed end end actionManager:BindGameActions(p)playersLeft.Value=#activePlayers end
-- Puts players into an active players table and runs readyPlayer for each player in that table
function PlayerManager.preparePlayers()
	-- Get all spawn locations in the folder
	local map = mapManager.getMap()
	if not map then
		return
	end

	local spawnLocations = mapManager.getSpawnLocations()
	if not spawnLocations then
		return
	end

	local availableSpawnPoints = spawnLocations:GetChildren()

	-- Get active players
	local players = Players:GetChildren()

	-- For every active player, load them into a table, and ready them with everything needed for gameplay (tools, listeners, spawn)
	for playerKey, whichPlayer in pairs(players) do
		table.insert(activePlayers, whichPlayer)

		-- Gets a spawn location and then removes it from the table so the next player gets the next spawn
		local spawnLocation = availableSpawnPoints[1]
		table.remove(availableSpawnPoints, 1)
		readyPlayer(whichPlayer, spawnLocation)

		-- Set player walkspeed
		local character = whichPlayer.Character
		local humanoid = character:FindFirstChild("Humanoid")
		if humanoid then
			humanoid.WalkSpeed = gameSettings.roundWalkSpeed
		end
	end

	-- Bind destroy action
	actionManager:BindGameActions(players)

	-- Update the value so the starting players can be displayed on the GUI
	playersLeft.Value = #activePlayers
end
