Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

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

Asked by 7 years ago
Edited 7 years ago

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)
0
Can you show some code so we can help User#5423 17 — 7y
0
Edited with some code that I know is horrible. BennyBoiOriginal 293 — 7y

1 answer

Log in to vote
0
Answered by
shayner32 478 Trusted Moderation Voter
7 years ago

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)

Ad

Answer this question