Im trying to make a teleport list in a game, if a friend is in your server ur friend will be in list but I cant figure out, can someone tell me how?
Can someone help me checking if friend is in same server with you?
1 answer
This is very easy to do. First, you need to specify yourself in the game.
local owner = game:GetService("Players"):FindFirstChild('YourNameHere')
Second, you need to specify who the player's names are with a table, like so:
local friends = {game:GetService("Players"):FindFirstChild('FirstFriendsNameHere'), game:GetService("Players"):FindFirstChild('SecondFriendsNameHere')} -- If you get the idea, you can continue the list.
Now that we have made a table, we need to constantly search through the game's player list and find a match to the table's content.
I have decided to not use a loop, as this will teleport you to them over and over again. Instead, we will use game.Players.PlayerAdded:Connect(function(plr) to detect when a player joins the game. Here is the code to search through the table.
game:GetService("Players").PlayerAdded:Connect(function(plr)
for i = 1,#friends do
if friends[i] then
if owner then
owner.Character:FindFirstChildWhichIsA("Part").CFrame = friends[i].Character:FindFirstChildWhichIsA("Part").CFrame
end
end
end
end)
Since you didn't actually try to make any code, this is NOT a requesting site. I will not put your name or your friend's name in any of the code. I will not compile it into one. Next time, at least try to learn before requesting from a non - request site.
3 comments
if you need to make it appear in the console or gui or something lmk
you can also try with a new method on roblox that allows you to that. message me if you wanna know it.
I want to find it with :GetFriends() function
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
what
just have a bar where u key in a player name and it will teleport u to him / her