Friend Teleport System

Hello, I hope you are feeling well! :smiley:. So basically I have been having problems in getting the JobId of the server where a particular Friend is.


1- I tried the function Player:GetFriendsOnline() but this one has a small bug since 2020 and still no fix, instead of giving the JobId it gives the GameId.
2- I also tried using the function TeleportService:GetPlayerPlaceInstanceAsync(UserId) but this one always gives me the error HTTP 403 (Forbidden).
3- I can’t use MessagingService because is limited to just one place as long as I know, in other words, it doesn’t support multiple places.


What else can I try?

3 Likes

Teleport to him inside a different game on in the current game?

My game is divided in three places:

Lobby (Main Place): I am trying to do this from the Main Place.
1- Multiplayer (Place)
2- Solo (Place)

Oh so like if he is in multiplayer place u wanna tp to him same with Solo place right?

They are in the main place, they click a button which displays all the friends that they have playing in the Multiplayer. They click the join button and they get teleported to that server where the friend is. Done.

local Players = game:GetService("Players")
 local player = Players.LocalPlayer
 local onlineFriends = player:GetFriendsOnline(200)
 for i, friend in pairs(onlineFriends) do
script.Parent.MouseButton1Click:Connect(function()
 if friend.PlaceId == 000000 or 000000 or 00000 then --put here ur 3 place Ids
game:GetService("TeleportService"):Teleport(friend.PlaceId, game.Players.LocalPlayers)
         end) 
   end
end
--Idk try this

Consider this code.

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

local LocalPlayer = Players.LocalPlayer

for _,friend in pairs(LocalPlayer:GetFriendsOnline()) do  
   if friend.PlaceId == 0 then -- replace with your place ID
       if friend.LastLocation then
           TeleportService:TeleportToPlaceInstance(friend.PlaceId, friend.VisitorId, LocalPlayer)
       end
   end
end

What that code will do is teleport the local player to the place but not to the server where its friend is. For example, maybe the player has 10 people playing in that place but in different server. Maybe the player decides to play with one of its friend so you will need to get the JobId of the server they are in to be able to teleport the player to that server.

1 Like

Isn’t VisitorId the UserId of the player? TeleportService:TeleportToPlaceInstance needs the JobId of the server.

Correct. You can learn more here:

The JobId can be found easily through using .GameId.

That’s the issue, there is a bug with that. Roblox doesn’t fix it ;(

Can you double check to see if this is enabled? You can access this via Game Settings and Security.

Yes that is enabled.


By the way look: Player:GetFriendsOnline() not acting as stated on wiki

I see, first time seeing this bug. It seems like there’s a workaround by using game:GetService("TeleportService"):GetPlayerPlaceInstanceAsync(uID). Have you tried using this?

Yes, I have tried using this method.

Interesting, running out of options here but I have one last thing that may work. Have you tried going on an online server or playing your game directly?

What do you mean? If I have joined my game? If so yes. The Lost Land [Survival] - Roblox

Yeah, I’m not too sure this does seem like an issue on Roblox’s end that needs to be fixed unfortunately. Good luck with your project nonetheless.

1 Like

Thank you for your time by the way. Thank you to @Legend_boysYTs as well! :smiley:

2 Likes

Hey, what was the solution you found for this issue?