TeleportService teleports me to wrong PlaceId

In my game, I have 2 gamemodes. One named “Normal” and the other one “Ranked Match”. The problem here is that “Ranked Match” teleports me to the “Normal” gamemode place instead, despite PlaceIds being correct in both scripts.

Normal gamemode script:

local memoryStore = game:GetService("MemoryStoreService")
local queue = memoryStore:GetSortedMap("Queue")

local tpService = game:GetService("TeleportService")

local minimum = 2
local maximum = 2

local placeId = 12397360213

local re = game.ReplicatedStorage:WaitForChild("QueueRE")

function addToQueue(player)
	queue:SetAsync(player.UserId, player.UserId, 2592000)
end

function removeFromQueue(player)
	queue:RemoveAsync(player.UserId)
end

local cooldown = {}

re.OnServerEvent:Connect(function(player, inQueue)	
	if cooldown[player] then return end
	cooldown[player] = true
	
	if inQueue == "Matchmaking..." then
		pcall(addToQueue, player)
	elseif inQueue == "Matchmake" then
		pcall(removeFromQueue, player)
	end
	
	task.wait(1)
	cooldown[player] = false
end)

game.Players.PlayerRemoving:Connect(removeFromQueue)

local lastOverMin = tick()

while task.wait(1) do
	local success, queuedPlayers = pcall(function()
		return queue:GetRangeAsync(Enum.SortDirection.Descending, maximum)
	end)
	if success then		
		local amountQueued = 0
		
		for i, data in pairs(queuedPlayers) do
			amountQueued += 1
		end
		
		if amountQueued < minimum then
			lastOverMin = tick()
		end
		
		local timeOverMin = tick() - lastOverMin
		
		if timeOverMin >= 20 or amountQueued == maximum then		
			local code = tpService:ReserveServer(12397360213)
			
			for i, data in pairs(queuedPlayers) do				
				local userId = data.value
				local player = game.Players:GetPlayerByUserId(userId)
				
				if player then
					local success, err = pcall(function()
						tpService:TeleportToPrivateServer(placeId, code, {player})
					end) 
					
					task.spawn(function()
						if success then
							task.wait(1)
							pcall(function()
								queue:RemoveAsync(data.key)
							end)
						end
					end)
				end
			end
		end
	end
end

And the Ranked Match script:

local memoryStore = game:GetService("MemoryStoreService")
local queue = memoryStore:GetSortedMap("RankMatchQueue")

local tpService = game:GetService("TeleportService")

local minimum = 2
local maximum = 2

local placeId = 12806806440

local re = game.ReplicatedStorage:WaitForChild("RankMatchRE")

function addToQueue(player)
	queue:SetAsync(player.UserId, player.UserId, 2592000)
end

function removeFromQueue(player)
	queue:RemoveAsync(player.UserId)
end

local cooldown = {}

re.OnServerEvent:Connect(function(player, inQueue)	
	if player:WaitForChild("Rank").Value >= 10 then
		if cooldown[player] then return end
		cooldown[player] = true

		if inQueue == "Searching..." then
			pcall(addToQueue, player)
		elseif inQueue == "Ranked Match" then
			pcall(removeFromQueue, player)
		end

		task.wait(1)
		cooldown[player] = false
	end
end)

game.Players.PlayerRemoving:Connect(removeFromQueue)

local lastOverMin = tick()

while task.wait(1) do
	local success, queuedPlayers = pcall(function()
		return queue:GetRangeAsync(Enum.SortDirection.Descending, maximum)
	end)
	if success then		
		local amountQueued = 0
		
		for i, data in pairs(queuedPlayers) do
			amountQueued += 1
		end
		
		if amountQueued < minimum then
			lastOverMin = tick()
		end
		
		local timeOverMin = tick() - lastOverMin
		
		if timeOverMin >= 20 or amountQueued == maximum then		
			local code = tpService:ReserveServer(12806806440)
			
			for i, data in pairs(queuedPlayers) do				
				local userId = data.value
				local player = game.Players:GetPlayerByUserId(userId)
				
				if player then
					local success, err = pcall(function()
						tpService:TeleportToPrivateServer(placeId, code, {player})
					end) 
					
					task.spawn(function()
						if success then
							task.wait(1)
							pcall(function()
								queue:RemoveAsync(data.key)
							end)
						end
					end)
				end
			end
		end
	end
end

I used a YouTube tutorial for these matchmaking scripts with some modifications here and there to fit my game properly.