So what I want to do is create a bunch of textbuttons on a surfacegui, but I need the textbuttons to equal the max players.
Here is what I have thought to do
for i=1,(game.Players.MaxPlayers) do [Generate TextButton code is functional and would go here] end
If this matters, this is going on a brick and will display the names of everyone who joins.
What I would do, is use the PlayerAdded and PlayerRemoving events. Here's an example:
This code will print [Player's Name] Has joined the server
when a new player is added and [Player Name] Has left the server
When the player leaves:
game.Players.PlayerAdded:connect(function(player) -- Calls the player print(player.Name.." Has Joined the Game") end) game.Players.PlayerRemoving:connect(function(player) print(player.Name.." Has left the game.") end)
So by using these events, you can easily:
Clone the GUI (When the player enters)
Edit the GUI (You're choice how)
Remove the GUI (by using :Destroy()
)
Hope I helped :D Feel free to PM me if you have any more trouble with this.