How would I make a player list like Arsenal?

This is what I’m trying to make (the player list): image
I want to make something like that for my admin panel, instead of having to type the username of the player.
I’m not very good with scripting so If anyone could give me some tips that would be greatly appreciated!

3 Likes

You can call game:GetService(“Players”):GetPlayers() to get an array of the players in-game and then iterate through it, create a TextLabel for each player and set the text accordingly and use a UIListLayout to automatically line the labels up

2 Likes

How would you get the names? (sorry im not good with scripting)
(btw this is my layout)
image

1 Like
local players = game:GetService("Players")
local playerList = players:GetPlayers()

This would return a list like such:

{players.twinqle, players.foodislife345678, players.Shedletsky}

You could iterate through it using a for loop and check the name of each player Instance

1 Like

How would I do the loop? (again sorry im a noob at scripting)

You would use a for loop

for _, player in pairs (playerList) do
     playerName = player.Name
     -- create textlabel and set text to playerName
end
2 Likes

To your Frame you can add a UIListLayout then once you open the GUI loop through all the Players which can be accessed by game.Players:GetPlayers() , then clone your template and parent it to the Frame , change the template’s Text to the player’s Name and Templates Name to the player’s Name. Once you close the GUI Destroy all the Templates from the Frame or you can add an if condition when looping through the players check if the Template exists in the frame.

Look at AlvinBlox on youtube for tutorials

That worked! Thanks for helping! Also idk how to remove the player from the list when they leave.

you can check whenever a player leaves to update the list:

game.Players.PlayerRemoving:Connect(function(PlayerRemoved)
     -- update list
end
1 Like

What would I write to update the list? Since im using this for kicking people it doesnt remove them from the list, but when they leave the game it does.

1 Like

Well, you can also refresh it when you kick it, since when you kick you have to send an event, so refresh it when the admin says to kick them

1 Like

I solved it already, Sorry! :sweat_smile:

Its fine mate! I love helping on the forum, im new here

1 Like

Im also new to the forums! :smile:

1 Like

Nice to meet ya mate!
30 letters

1 Like