Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Finding all friends in your server?

Is there a way to find all your friends in your server, then write them all seperate in different textlabels? if so can some1 help me?

2 comments

1

Loop through the players in the server and use the "IsFriendsWith()" function to check if they are a friend. If so, add a TextLabel and change the text to that player's name.

0

y u answer in comments ;-;

1 answer

I would add a Player Added event

game.Players.PlayerAdded:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local screen = game.StarterGui.FriendScreen -- Make sure you actually create it or edit the name
for amount, plr in pairs(game.Players:GetPlayer()) do
if plr:IsFriendsWith(player.Name) then
		wait()
		local friendtxt = Instance.new("TextLabel", screen)
		--Do the properties of the var friendtxt
		friendtxt.Text = player.Name.. " your friend has joined the server"
		wait(3) -- Delay time
		friendtxt:Destroy() -- I went with the simple destroy but you can also tween the text label then destroy it
	end
end)

Hopefully this helped you,tell me if you find any errors :)

This discussion is preserved as it was. New answers, comments, and votes are closed.