How can i create a "Join Friends server Screen"?

I want to create a screen to join friend games.

I found a video but it dont worked

This is that i tried:


local Template = script.Template
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local currentPosition = UDim2.new(0,0,0,0)
local TeleportService = game:GetService("TeleportService")

local function cloneObject(object, Parent)
	local clonedObject = object:Clone()
	clonedObject.Parent = Parent
	return clonedObject
end

for i,v in pairs(LocalPlayer:GetFriendsOnline()) do
	local FriendImage = cloneObject(Template, script.Parent)
	FriendImage.Image = Players:GetUserThumbnailAsync(v.VisitorId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size100x100)
	FriendImage.Position = currentPosition
	FriendImage.Name = v.UserName
	FriendImage.Username.Text = v.UserName
	if v.LastLocation then
		FriendImage.JoinButton.MouseButton1Click:Connect(function()
			print(v.GameId, v.PlaceId)
			TeleportService:TeleportToPlaceInstance(v.PlaceId, v.VisitorId, LocalPlayer)
		end)
	end
	
	currentPosition = currentPosition + UDim2.new(0,0,0,100)
end

Objects:

Join friends screen

This is the frame:

This is the InGame error:
Join friends screen error

and this is the console:

This is the video that i found

1 Like

but it worked to me adding nil

see

Only the button dont works

This isn’t really related to the topic, but why would you want to create a screen that takes players away from your game? (if it’s a “hub” kind of game then ignore this question)

idk i just want to do it

only to players can join friends

a games like adopt me have it when a friend are playing it on different server

Ohhh, I think I understand what you’re trying to do, scratch the other reply. About the error it throws at you - did you try joining a different friend? The person you tried to join is probably in a private game (or a restricted one, whatever that means).

yes the two errors are by different friends´

the other two prints are of the “place id” i think

I never used TeleportService, but I think you need both the PlaceId and the GameId - not sure what the difference is. Try this instead:

if v.LastLocation then
	FriendImage.JoinButton.MouseButton1Click:Connect(function()
		print(v.GameId, v.PlaceId)
		TeleportService:TeleportToPlaceInstance(v.PlaceId, v.GameId, LocalPlayer)
	end)
end

Edit: Changed v.VisitorId to v.GameId.
Another edit:

PlaceId number The place ID of the friend’s last location.
GameId string The DataModel.JobId of the friend’s last location.

it says the same

join friends screen error 2

Our game had the exact same problem but it went away on its own. According to this thread and reply, it is an issue on Roblox’s end and they attempted to fix it. I suppose you could bump the thread with your input, as there are plenty of developers reporting that whatever Roblox did didn’t work. Otherwise, it’ll work from time to time, but there’s no telling when.

Another reply in that thread said that it started to work when they ran it off of the server instead of following the DevHub documentation which says to run it from the client. You could try that if that’s not already the case.

then i think it can be like the “ResetButtonCallback SetCore”

that depends of the stats

Hey! Roblox has a Default Service part of the Social service, Here is a Little Code to help you out, This is a child of a Button.

local social = game:GetService("SocialService")
script.Parent.MouseButton1Click:Connect(function()
	social:PromptGameInvite(game.Players.LocalPlayer)
end)
1 Like

These is to invite but i want to join

these is to people can join but not you

Oh, Sorry. I guess I misunderstood your post.

i am trying to make a system like “Adopt Me!”

so you can join your friends another servers

A game can have different places. You can get thrown around a game with uses the same data store services for example.

I know specific servers have their specific ID you might wanna save their current server on a data store when they join. Let me get reference here.

This could help you

1 Like

then the jobId its the code of the server to teleport and the PlaceId its the id of the game to teleport

1 Like

Ignore the idea of saving it to a data store, it’s not a great method at all.

This method returns the JobId for online friends.

This can be also read by the client. So you can get the list via client too, and then just use a remote event to teleport the player into another server;