I am trying to create a script that would teleport to the users friend by getting the name of the friend inside of the textbox and then it looks for that specific player and teleports you directly to them.
Ive tried using :GetFriendsOnline() and other things but nothing seems to actually work.
All I ask for is the right direction and maybe even a example script to get where im trying to get.
Hello, from what I understand you are trying to make a friend-join list? Please correct if I am wrong.
Using :GetFriendsOnline() is the correct start.
You can use a localscript. I will put some code below and explain it.
local TextBox = Instance.new("TextBox")
local FriendsOnline = game.Players.LocalPlayer:GetFriendsOnline()
-- once the TextBox has been left it will try to tp you to that friend
-- maybe add a textbutton you need to press to confirm the teleportation
TextBox.FocusLost:Connect(function()
local InputUser = TextBox.Text
-- looping through all friends that are online
for i, friend in pairs(FriendsOnline) do
if (InputUser == friend.UserName) then
local FriendGame = friend.PlaceId -- used to locate the experience (game)
local FriendServer = friend.GameId -- used to locate the server of the experience
-- place teleportation code below
end
end
end)
-- if you want you can update the FriendsOnline-List every now and then
while task.wait(20) do
FriendsOnline = game.Players.LocalPlayer:GetFriendsOnline()
end
Let me know if you have a question or if I missunderstood the problem you are having.
this is exactly what ive been looking for, you have pushed me in the right direction and I can add onto this. Thanks, ive been on this about all night.