Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Finding all friends in your server?

Asked by 6 years ago

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?

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. cfiredog 274 — 6y
0
y u answer in comments ;-; Goulstem 8144 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

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 :)

Ad

Answer this question