Teleports keep breaking

im using the safe teleport module roblox provides and sometimes I’ll error with
“Reserve server should not be provided with reserved server access code.”
this breaks all future teleports

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
		error(("Invalid teleport [%s]: %s"):format(teleportResult.Name, errorMessage))
	end

	SafeTeleport(targetPlaceId, {player}, teleportOptions)
end

TeleportService.TeleportInitFailed:Connect(handleFailedTeleport)

return SafeTeleport

i’ve tried fixing the issue but I have no idea what causes it

2 Likes

what im sending

local TeleportService = game:GetService("TeleportService")
local SafeTeleport = require(game:GetService("ReplicatedStorage"):WaitForChild("SafeTeleport"))

local teleportOptions = Instance.new("TeleportOptions")
teleportOptions.ShouldReserveServer = true

local GameId = 17523803873
SafeTeleport(GameId, InLobby[v], teleportOptions)
1 Like

Is the first code a module script?

yes it is a module script (word limittt)

okay I think I fixed the issue for now

Wait what was the issue? I’m struggling with the exact same thing.

1 Like

instead of having teleport options at the top of the script, I made a new instance each teleport

if #InLobby[v] > 0 then
						
	local teleportOptions = Instance.new("TeleportOptions")
	teleportOptions.ShouldReserveServer = true
							
	local success, response = pcall(function()
	   game:GetService("ReplicatedStorage").Remotes.Fade:FireAllClients(InLobby[v])
	   SafeTeleport(GameId,InLobby[v],teleportOptions)
	end)
end
1 Like

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