I'm working on a Place Teleport gui and I'm having trouble finding the resources I need to enable a player to join a friends server. So far I have the basic teleport from place to place, however I'm having trouble figuring out how to follow friends playing the same game. Could someone please post a link to the wikia or somewhere that explains how to do this?
✓ ANSWER ACCEPTED
Help w/ making a follow friends GUI?
1 answer
✓ Accepted answer
You need to use GetFriendsOnline, GetPlayerPlaceInstanceAsync, and TeleportToPlaceInstance
This is an example of what you could do
--The whole script has not been tested, change it your likings
function GetFriends(player) --I do not feel like upvaluing it
return player:GetFriendsOnline(200) --max is 200
end
function GetFriendsInGame(friends)
local new_friends = {} --dont mean it like thatl
local placeid = game.PlaceId
local temp
for x = 1, #friends do
temp = friends[x]
if (temp.IsOnline) then
if (temp.PlaceId == placeid) then
new_friends[#new_friends + 1] = temp
end
end
end
return new_friends
end
--you could make a gui that selects a friend, and maybe hit follow friendinto game
--if you do you then do
function FollowFriend(player, userId)
--player == main player, userId == the player to follow
--(if this was for the gui, and the player hit the follow button for the player, you would provide the VisitorId from the online friends table)
local tp = game:GetService("TeleportService")
local success, emsg, placeId, instanceId = tp:GetPlayerPlaceInstanceAync(userId)
if (success) then
tp:TeleportToPlaceInstance(placeId, instanceId, player)
else
warn(emsg)
end
end
Cite: GetPlayerPlaceInstanceAsync GetFriendsOnline TeleportToPlaceInstance
2 comments
0
god danget, I never get links to work
0
Thanks, gonna work on this! I'll let you know if I have any trouble.
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
I'm not sure this is possible.
This is possible in Swordburst Online and i have used it. I think you need to know the other players id to teleport but apart from that i cannot help :c