How can I make a list of the players in the server and make them appear in a GUI?

I’m making a GUI where Ican modify myself or other player’s WalkSpeed and JumpHeight. It works perfectly with a TextBox but I wanted to make it easier by adding some sort of list where you can see all the players in the server and choose one of them

2 Likes

Do you mean like choosing a random one? Or actually getting everyone in a list?

1 Like

Ah, You can use game.Players:GetPlayers() and iterate through all players and create buttons with their name to make a list.
Then, add a playerAdded ande PlayerRemoving function in a server script and have it send that data through a remote event to the GUI, which adds new players and removes old players from the list.

2 Likes

you can also use ChildAdded and ChildRemoving instead of using a remote

I would use GetPlayers() every heartbeat over PlayerAdded, because it starts a new count every heartbeat, as opposed to using PlayerAdded where if something goes wrong, the count’s always going to be off

2 Likes

I tried something like this but I have no idea how to make the buttons look organized with rows and columns

Getting everyone in a list so I can choose a specific player

Ah, okay, you can use a UiList layout inside a scrolling frame to make frames nicely fit in a list of players.
Scrolling frame to deal with lots of players on a list, inside the scrolling frame insert a UiListLayout and configure the layout to be vertical. Now, every time a player button is added to the scrolling frame, it will automatically be placed below the last player

2 Likes

I did what you suggested to the existing GUI and it worked perfectly!, thanks for the help

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.