Script to join friends not working

Hello Community, I am trying to solve this script but I do not know, this is a script that when you click the Join button automatically joins the friend.
But it doesn’t work and there are no problems in the output.

Image 1:
Screenshot_6
Image 2:
Screenshot_7
Image 3:
Screenshot_8

LocalScript - StarterGui:

local player = game.Players.LocalPlayer
local friends = player:GetFriendsOnline(10)
local temp = game.ReplicatedStorage.FriendList
local tps = game:GetService("TeleportService")


for i,v in pairs(friends) do
	local newFrame = temp:Clone()
	newFrame.PlayerName.Text = v.UserName
	newFrame.Avatar.Image = "http://www.roblox.com/Thumbs/Avatar.ashx?x=150&y=150&Format=Png&username="..v.UserName
	newFrame.Parent = script.Parent.FriendGui.Frame.ScrollingFrame
	if v.LastLocation then
		newFrame.GameName.Text = v.LastLocation
		newFrame.JobId.MouseEnter:Connect(function()
			newFrame.JobId.Text = v.GameId
		end)
		newFrame.JobId.MouseLeave:Connect(function()
			newFrame.JobId.Text = ""
		end)
		newFrame.Join.MouseButton1Click:Connect(function()
			tps:TeleportToPlaceInstance(v.PlaceId, v.GameId, player)
		end)
	end
end

Are you in studio testing this?, It doesn’t work in studio. Try a live game.

I tried it live, but it still doesn’t work when I click Join

You have you’re alt accounts on right? Im assuming on another device you have ScriptSPloit_Dev?

Yes, I have friends who are attached to other games.

Is the TP to other places enabled?

Are you trying to teleport to your friends in the same actual game or in a whole other game ?

I have it, it does not work

" TeleportToPlaceInstance" only works inside the same game as stated here:

Well, I am trying to get the LocalPlayer to teleport to where the friend is, whether in a server or other games.

Here’s an example on the end of the page, but is in a ServerScript

This can be used with Remote events I suppose

Indeed, place a remote event on the replicated storage and fire it from the client

As far as I’m aware, TeleportService only works on the server, you do indeed need to use RemoteEvents.

Not totally true, there are some functions that only works in the client like the example at the bottom of the Teleport Service page, but most of the functions works only on the Server as you said

1 Like

Ohh, sorry for my mistake, I thought TeleportService worked entirely from the server.

This is really difficult
what I could know is that this would be the local script from the Client:

local player = game.Players.LocalPlayer
local friends = player:GetFriendsOnline(10)
local temp = game.ReplicatedStorage.FriendList
local tps = game:GetService("TeleportService")


for i,v in pairs(friends) do
	local newFrame = temp:Clone()
	newFrame.PlayerName.Text = v.UserName
	newFrame.Avatar.Image = "http://www.roblox.com/Thumbs/Avatar.ashx?x=150&y=150&Format=Png&username="..v.UserName
	newFrame.Parent = script.Parent.FriendGui.Frame.ScrollingFrame
	if v.LastLocation then
		newFrame.GameName.Text = v.LastLocation
		newFrame.JobId.MouseEnter:Connect(function()
			newFrame.JobId.Text = v.GameId
		end)
		newFrame.JobId.MouseLeave:Connect(function()
			newFrame.JobId.Text = ""
		end)
		newFrame.Join.MouseButton1Click:Connect(function()
			game.ReplicatedStorage.PlayerTeleport:FireServer()
		end)
	end
end

The problem is that I have no idea what to put here.

game.ReplicatedStorage.PlayerTeleport.OnServerEvent(function()
	-- Here
end)

The first parameter of OnServerEvent is the Player object I believe (So that you know who’s firing it)

local TPService = game:GetService("TeleportService")

game.ReplicatedStorage.PlayerTeleport.OnServerEvent:Connect(function(Player()

end)

I’m not exactly sure which one you should do, it’s either gonna be: TeleportToPlaceInstanceAsync or GetPlayerPlaceInstanceAsync or both oof

Think what Is best
both of them :slight_smile: