Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How can I get all the players names and put them all on text buttons?

So what I am trying to make is a frame with a bunch of text buttons and the text buttons have all the players in the game names on them.

I have the test buttons in folders. There is 2 folders. Here is my code. I am a beginner scripter.

one = script.Parent.one:GetChildren()
two = script.Parent.two:GetChildren()
player = game.Players:GetPlayers()

game.Players.PlayerAdded:connect(function()
	one.Text = player.Name
end)

2 comments

0

Can you show some code so we can help

0

Edited with some code that I know is horrible.

1 answer

Are you trying to make one textbutton for every player in the game, or are you trying to put them all on one textbutton? If you're trying to do either one, you'll probably need a for loop of some sort to get the names of the players: http://wiki.roblox.com/index.php?title=For_loop. The current code you have would error I believe, as it is trying to convert a table into a string. If you are trying to only make the textbutton show the most recently joined player's name, then you've got your code wrong. Try this:

one = script.Parent:WaitForChild("one")
two = script.Parent:WaitForChild("two")

game.Players.PlayerAdded:connect(function(player)
    one.Text = player.Name
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.