Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why do I get this teleportation error when I try to join someone's game with a script?

Asked by 3 years ago
Edited 3 years ago

I've been trying to build a script to join one of my friends' games automatically.

What does my script do?

First, it searches through my friends list and checks if the player I chose is playing a game and is on my friends list. Then, it tries to join that server.

What is the problem?

This script is not giving me any syntax errors, but when I join the game (NOT IN STUDIO), it says this:

Teleportation Failed

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

It gives me this error every game. Is this a Roblox issue or am I doing something wrong?

Here's the script: (this is a local script)

local player = game.Players.LocalPlayer

local teleportService = game:GetService("TeleportService")

local onlineFriends = player:GetFriendsOnline(200)

script.Parent.MouseButton1Click:Connect(function()
    local playerToFollow = script.Parent.Parent.TextBox.Text

    for i, v in pairs(onlineFriends) do
        if v.UserName:lower() == playerToFollow:lower() then
            if v.IsOnline or v.LastLocation then
                print(v.PlaceId)
                print(v.LastLocation)
                print(v.GameId)
                foundUsername = true
                teleportService:TeleportToPlaceInstance(v.PlaceId, v.GameId, player)
                break
            else
                print("Couldn't teleport because: "..playerToFollow.." is not online or is not playing a game.")
            end
        end
    end

    if foundUsername == nil then
        print("User '"..playerToFollow.."' is not on your friends list.")
    end
end)

How can I fix this? Any help/advice is appreciated! Thank you! - Green_Lime2

1 answer

Log in to vote
0
Answered by
Amiaa16 3227 Moderation Voter Community Moderator
3 years ago

It happens bcause you're trying to teleport to a place which either:

  • belongs to another game and isn't its main place (so it's protected from foreign teleports)
  • is a private server created by the game
  • is a vip server

You can't teleport to those and there is no way to "fix" that

Ad

Answer this question