Attempted to teleport to a place that is restricted. Error Code: 773

I am trying to make a Join Friend GUI in my game.

When you join your friend it comes up with the error: Attempted to teleport to a place that is restricted. Error Code: 773

I have tried multiple solutions on the devforum and none of them have solved my problem.

Also in the Developer Console you get this error: raiseTeleportInitFailedEvent: Teleport failed because This experience is restricted (Unauthorized)

Here is my code:

local Players = game:GetService("Players")
local player = Players.LocalPlayer
local PlayerGui = player:WaitForChild("PlayerGui")
local TeleportService = game:GetService("TeleportService")
local TweenService = game:GetService("TweenService")
local FadeIn = script.Parent:WaitForChild("LoadingScreen").Teleport
local LoadingScreen = game.ReplicatedStorage.MapAddOns.Loading
local CantPress = script.Parent:WaitForChild("Main").CantPress
local Button = script.Parent:WaitForChild("LoadingScreen").Main.JoinFriend
local ExitButton = script.Parent:WaitForChild("LoadingScreen").JoinFriendsFrame.Back
local db = false

Button.MouseButton1Click:Connect(function()
	local temp = game.ReplicatedStorage.MapAddOns.Template
	for i,v in pairs(player:GetFriendsOnline(200)) do
		if v.LastLocation and v.PlaceId == 7191939128 and v.GameId then
			local newFrame = temp:Clone()
			newFrame.PlayerName.Text = v.UserName
			newFrame.PlayerImage.Image = "http://www.roblox.com/Thumbs/Avatar.ashx?x=150&y=150&Format=Png&username="..v.UserName
			newFrame.Parent = script.Parent:WaitForChild("LoadingScreen").JoinFriendsFrame.Holder
			newFrame.Join.MouseButton1Click:Connect(function()
				if v.LastLocation and v.PlaceId and v.GameId then
					if db == false then
						db = true
						CantPress.Visible = true
						TweenService:Create(FadeIn,TweenInfo.new(.8),{BackgroundTransparency = 0}):Play()
						wait(1)
						local TempLoadingScreen = LoadingScreen:Clone()
						TempLoadingScreen.Parent = PlayerGui
						
						TeleportService:SetTeleportGui(TempLoadingScreen)
						TeleportService:TeleportToPlaceInstance(v.PlaceId, v.GameId, player)
					end
				end
			end)
		end
	end
end)

ExitButton.MouseButton1Click:Connect(function()
	wait(1)
	for i,v in pairs(script.Parent:WaitForChild("LoadingScreen").JoinFriendsFrame.Holder:GetChildren()) do
		if v:IsA("Frame") then
			v:Destroy()
		end
	end
end)
3 Likes

Could it be cuz the experience is private?

No the experience is public not private

This may be the reason Image from Gyazo

I’ve already tried turning that on and off and it hasn’t done anything

The place you are teleporting to is private:

For security reasons, Roblox denies teleporting to restricted places when unauthorized, so you can’t use TeleportService to sneak in private experiences.

Try making the destination place public and attempt to use the function again.

1 Like

It was public i made it private just now

What exactly would you like to achieve with the script? That way, we have more insights in what direction to look.

It is supposed to allow you to join your friends in my game
(The game is a multi place game)

Is this script in the same game universe as the place you are teleporting to? Are you using reserved servers in your game (then TeleportToPlaceInstance won’t work!)? Is your friend that you teleport to not in a vip server?

If it’s not the same game universe, in which did you set ‘allow third party teleports’ to true?

In any case, as seen on the doc page for TeleportToPlaceInstance, you may want to try TeleportAsync
(note: must be called from server)
https://developer.roblox.com/en-us/api-reference/function/TeleportService/TeleportToPlaceInstance

Good luck!

5 Likes

The script is in the same game as the place I am teleporting to, my game does not use Reserved Servers, the person I am teleporting to is not in a VIP server.

Using TeleportAsync didn’t resolve the issue.

Oh thats curious… So you used a remote event to call TeleportAsync on the server and still got the same teleport error? Then I suppose calling TeleportToPlaceInstance from server also won’t help. Note that when calling it locally you don’t need to provide the player argument, but that doesn’t matter (passing localplayer works too).

It could simply be a roblox bug, for some reason, but then it would likely resolve itself shortly and not persist. Do you have access permissions on the place set to ‘all’?

You could double check the job id using GetPlayerPlaceInstanceAsync on the server… I’m pretty sure it should be a match, though… GetFriendsOnline doesnt give a placeid when players are browsing the website so that can’t be it.

Sorry, I’m not sure what could be wrong, I may well be missing something, but I would experiment with other ways of getting the jobId and teleporting to the jobId that your friend is in. Using the new teleportAsync from the server should be the most reliable. Since your TeleportToPlaceInstance function doesn’t error but tries to teleport you, resulting in that popup, it can otherwise be a bit tricky to find out what actually goes wrong to deny you access permission.

Assuming there is only one instance of that place running anyway, it may be worth to try if you are able to join your friend with a normal teleport to that placeId (ignoring the job id). Or maybe someone else has any idea… I don’t immediately see it!

In fact in one of my games, I also use the jobId (from either GetFriendsOnline or GetPlayerPlaceInstanceAsync) to teleport players from the client using TeleportToPlaceInstance (to other non-reserved non-vip places in the same universe), so in principle it should work!

1 Like

My fault man, using TeleportAsync worked.

Appreciate the help!

1 Like