Cant seem to teleport players "raiseteleportinitfailedevent: teleport failed because unable to join game 512(unauthorized)"

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    trying to teleport a player to a place. the place is published and set to public
  2. What is the issue? Include screenshots / videos if possible!
    {F56E9ED1-CCCA-4B3B-8F89-FE63EAE37166}
    I keep getting this error
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    tried using teleportservice:teleport and teleportservice:teleportasync. also tried the roblox “handle failed teleports” modulescript
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local teleportOptions = Instance.new("TeleportOptions")
		teleportOptions.ShouldReserveServer = true
		local Players = game:GetService("Players")
		local ServerScriptService = game:GetService("ServerScriptService")
		local SafeTeleport = require(ServerScriptService.SafeTeleport)
		local TARGET_PLACE_ID = 83572069075685
		local playerToTeleport = Players:GetPlayers()[1]
		SafeTeleport(TARGET_PLACE_ID, {playerToTeleport}, teleportOptions)

the “safeteleport” modulescript is the same as the one in roblox’s “handle failed teleports” article

Hey there! I’m not sure if this would be the problem but for the place that you are trying to teleport players to, is Third Party teleports allowed? You can access this through game settings

yea, this setting is allowed on both the start game and the target place

1 Like

Ok, I also had a similar problem of teleporting between games but I didn’t get this error. However, I am wondering, are you testing the teleports within studio or the roblox client?

im testing with the roblox client.

1 Like

Could you send your safe teleport module, just to make sure? Thanks!

sure, module script name is SafeTeleport located in serverscriptservice.

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
1 Like

Have you published the place, and is the place private?

published both places, and neither are private

nevermind, none of these was the issue. it was just me using multiple roblox instances on the same machine, and I guess teleport service gets confused or something.