Invalid teleport [unauthorized]: Access code for reserved server is not valid

I used to make reserved server and store the access code, etc in MemoryStoreService,
and teleport players in queue to the reserved server.

but these are error messages I received:


image

and Here is safeteleporting script if you need this to help me. (as I recall, I found this at creator hub)

local TeleportService = game:GetService("TeleportService")

local ATTEMPT_LIMIT = 5
local RETRY_DELAY = 1
local FLOOD_DELAY = 15

local function SafeTeleport(placeId, players, options)
	local attemptIndex = 0
	local success, result -- define pcall results outside of loop so results can be reported later on

	repeat
		success, result = pcall(function()
			return TeleportService:TeleportAsync(placeId, players, options) -- teleport the user in a protected call to prevent erroring
		end)
		attemptIndex += 1
		if not success then
			task.wait(RETRY_DELAY)
		end
	until success or attemptIndex == ATTEMPT_LIMIT -- stop trying to teleport if call was successful, or if retry limit has been reached

	if not success then
		warn(result) -- print the failure reason to output
	end

	return success, result
end

local function handleFailedTeleport(player, teleportResult, errorMessage, targetPlaceId, teleportOptions)
	if teleportResult == Enum.TeleportResult.Flooded then
		task.wait(FLOOD_DELAY)
	elseif teleportResult == Enum.TeleportResult.Failure then
		task.wait(RETRY_DELAY)
	else
		-- if the teleport is invalid, report the error instead of retrying
                -- this printed the error as title
		error(("Invalid teleport [%s]: %s"):format(teleportResult.Name, errorMessage))
	end

	SafeTeleport(targetPlaceId, {player}, teleportOptions)
end

TeleportService.TeleportInitFailed:Connect(handleFailedTeleport)

return SafeTeleport

this is part of my matchmaking system script:

local AccessCode, PrivateId = 123, 456
if not isStudio then
	AccessCode, PrivateId = TpService:ReserveServer(game.PlaceId)
end
for leaderId, memDatas in Parties do
	--this function sends messages to all lobby servers globally
	teleportPlayersToGame(leaderId, AccessCode, QueueMap)
end
tryRepeat(function()
	return RunningGamesMap:SetAsync(PrivateId, {
		["AccessCode"] = AccessCode;
		["CanJoin"] = canJoinMid;
		["Parties"] = Parties;
	}, 3600, modeName)
end, 3)

Is it impossible to make a reservedServer with the same placeId as the server it teleport from?
or is this just roblox’s engine problem?(I hope so)
please somebody help me

nevermind, I solved this problem myself. the placeId which tried to teleport to and the reserveServer placeId was different. So I made them the same as each other, and problem solved. sorry!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.