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:
Image 2:
Image 3:
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
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
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