How can I find the people in the server?

How can I find the specific names of the people in the server

In all servers or just the specific players in the current game?

The specific players in the current game.

for _,v in pairs(game.Players:GetChildren()) do
print(v) – Prints the name of every player in the server
end

How would I get the specific names without printing? Like make a varible or make a gui for it. Sorta like a trading gui

You can use GetPlayers which is a namecall of Players

-- // Declared Services

local Players = game:GetService("Players");

-- // Private Variables

local NamesNeeded = {"Ihaveash0rtname", "xxoof_oofoofxxALT"}
local FoundInList = {}
-- // Main

for Index, Value in Players:GetPlayers() do
    if table.find(NamesNeeded, tostring(Value) then
       table.insert(FoundInList, Value)
   end
end

This script will get the players in the table NamesNeeded then will search through the current players and if any of the players have the name(s) in NamesNeeded, they are added to our FoundInList which you can call later (Which will show active players)

What names do you want to get? Do the players have to meet a specific criteria?

I want to get every single name in the server. I need to be able to capture those names and put them in an “Add Friend” Type of thing in game.

If you are wanted the names for trading, you would search through all players then create a new Button for each player that will call a function most likely named NewPlayer that you can press to trade

What would be the base of it? Would I use :GetPlayers() and if I did how do I get the specific names?

Can you please tell me what you are exactly trying to make so this can be easier to explain as I can code exactly what you need.

I am remaking discord in Roblox and I want you to be able to add friends within the server. Then you can chat with them.

Well if you wanted specific names you would compare it to a table of player you already have and just check if the new player is not already in that table, then add them to the table. Otherwise you can use Players.PlayerAdded for new players that join.

I could do that, ill let you know how it goes

Ah, in that case, you would have to use GetPlayers to get all the players then create a new UI for each one of those players, click on the player and call a remote that would get chat logs (DO NOT LOG THAT MANY CHATS AS IT WOULD FILL UP THE DATASTORE 2 MUCH (Keep like up to 10 messages and wipe them after a day or two).