function PlayerManager.PreparePlayers(e)local u=workspace:FindFirstChild("\082\097\099\101\116\114\097\099\107")if not u then return end local R=u:FindFirstChild("\083\112\097\119\110\076\111\099\097\116\105\111\110\115")if not R then return end local p=R:GetChildren()for e,u in pairs(PlayerManager.ActivePlayers)do local R=p[1]table.remove(p,1)PlayerConverter:PlayerToSpeederServer(u,PlayerManager.Selections[u],true)readyPlayer(u,R)CheckpointEvent:FireClient(u,{{"\115\101\116\065\099\116\105\118\101",true},{"\115\101\116\117\112"}})end end function PlayerManager.StartPlayer(e)for e,u in pairs(PlayerManager.ActivePlayers)do local R=u.Character or u.CharacterAdded:wait()local p=R:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")if p then p.Anchored=false else PlayerConverter:SpeederToPlayerServer(u)end end end

function PlayerManager:PreparePlayers()
	-- Get all spawn locations in the folder
	local map = workspace:FindFirstChild("Racetrack")
	if not map then return end
	
	local spawnLocations = map:FindFirstChild("SpawnLocations")
	if not spawnLocations then return end
	
	local availableSpawnPoints = spawnLocations:GetChildren()
	
	-- For every active player, load them into a table, and ready them with everything needed for gameplay
	for _, player in pairs(PlayerManager.ActivePlayers) do
		-- 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)

		PlayerConverter:PlayerToSpeederServer(player, PlayerManager.Selections[player], true)
		readyPlayer(player, spawnLocation)
		CheckpointEvent:FireClient(player, {{"setActive", true}, {"setup"}})
	end
end
	
function PlayerManager:StartPlayer()
	-- For every active player, unanchor their HumanoidRootPart so that they can start racing
	for _, player in pairs(PlayerManager.ActivePlayers) do
		local character = player.Character or player.CharacterAdded:wait()
		local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
		
		if humanoidRootPart then
			humanoidRootPart.Anchored = false
		else
			-- Something is wrong, reload player in lobby
			PlayerConverter:SpeederToPlayerServer(player)
		end
	end
end
