local function i(i)for i,F in pairs(gameState.enemies)do F:Destroy()end local F=ReplicatedStorage.Levels[i]for i,F in pairs(F.Enemies)do local r=game.ServerStorage.Enemies[F.Name]:Clone()r.Parent=workspace gameState.enemies[#gameState.enemies+1]=r end gameState.level=i end
-- Create the level loader
local function loadLevel(level)
	-- Clear the current level
	for _, enemy in pairs(gameState.enemies) do
		enemy:Destroy()
	end

	-- Create the new level
	local levelData = ReplicatedStorage.Levels[level]
	for _, enemyData in pairs(levelData.Enemies) do
		local enemy = game.ServerStorage.Enemies[enemyData.Name]:Clone()
		enemy.Parent = workspace
		gameState.enemies[#gameState.enemies + 1] = enemy
	end

	-- Set the new level
	gameState.level = level
end
