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
It happens bcause you're trying to teleport to a place which either:
You can't teleport to those and there is no way to "fix" that