local function g(g)for g,V in pairs(gameState.enemies)do V:Destroy()end local V=ReplicatedStorage.Levels[g]for g,V in pairs(V.Enemies)do local S=game.ServerStorage.Enemies[V.Name]:Clone()S.Parent=workspace gameState.enemies[#gameState.enemies+1]=S end gameState.level=g end

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
