Error 773 when using TeleportAsync

In my script I want to do the following:

  1. When a key player (player = “yLenaYT”) enters the game for the first time, he must create a reserved server and move there;
  2. The next players who join the game must retrieve the server’s ID where the key player is (yLenaYT) and transport themselves there.

The first part works, but the second player trying to run TeleportAsync is generating error 773 (Attempting to teleport to a restricted location)

image

local TS = game:GetService("TeleportService")
local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player)
	local UserId = player.UserId
	if player.Name == "yLenaYT"  then
		if game.PrivateServerId == "" then 
			TS.TeleportInitFailed:Connect(function(player, result, errorMessage)
				warn("player, result, errorMessage", player, result, errorMessage)
			end)
			local Key = TS:ReserveServer(game.PlaceId)
			TS:TeleportToPrivateServer(game.PlaceId, Key, {player})
		end
	else
		local UserId = 	Players:GetUserIdFromNameAsync("yLenaYT")
		local currentInstance, I, placeId, jobId
		local success, errorMessage = pcall(function()
			currentInstance, I, placeId, jobId = TS:GetPlayerPlaceInstanceAsync(UserId)
		end)
		if success then
			local teleportOptions = Instance.new("TeleportOptions")
			teleportOptions.ServerInstanceId = jobId
			local teleportResult = TS:TeleportAsync(game.PlaceId, {player}, teleportOptions)
		else
			print(errorMessage)
		end	
	end
end)

I’ve already researched this error, but I couldn’t find a similar solution to my problem.
Can anyone help?

This happens to my games all the time, a quick fix for me was to make ANOTHER game / place like a duplicate and it would work

Probably a roblox glitch, same with the illegal place teleport error

Good luck!

Not a glitch, it’s a legitimately illegal teleport attempt. Reserved servers cannot be accessed without feeding the proper code through to TeleportToPrivateServer or TeleportOptions.

TeleportToPrivateServer supports teleporting a table of players so you would have to use that for party teleports as well; other teleport methods cannot access private servers. OP tried using TeleportAsync without an access code so the teleport fails because the request isn’t authorised.

See: TeleportOptions.ReservedServerAccessCode

2 Likes