Hi!
How to print all player name in one time?
I have try to use
for i,v in pairs(game.Players:GetPlayers()) do
print(v.Name)
end
but it will print per people
so I want to know how to collect all name in one and print it
Thank you
Hi!
How to print all player name in one time?
I have try to use
for i,v in pairs(game.Players:GetPlayers()) do
print(v.Name)
end
but it will print per people
so I want to know how to collect all name in one and print it
Thank you
Can you make it more clear that what do you exactly want? can send a screenshot or something?
I want to get all player and make it print it
like there are player named GalaxySMediaXz and GalaxySmediaCaster
if I use the script
for i,v in pairs(game.Players:GetPlayers()) do
print(v.Name)
end
it will print like this
GalaxySMediaXz
GalaxySmediaCaster
I want it to print like GalaxySMediaXz, GalaxySmediaCaster
Sorry for bad English
I am not sure if this is what you are looking for, but try this:
local players = {}
for i, v in pairs(game.Players:GetPlayers()) do
table.insert(players, v.Name)
end
print(players)
And obviously, just print the table.
it print like this
table: 0xda080153ceb6b7a9
Sorry about that, you cant concat strings, and i have edited my previous post.
it still print like this
table: 0xa76cff9558d0d779
What if you try something like this
local players = ""
for i, v in pairs(game.Players:GetPlayers()) do
players = players..v.Name..", "
end
print(players)
Try this:
local players = {}
for i, v in pairs(game.Players:GetPlayers()) do
table.insert(players, v.Name)
end
print(unpack(players))
It worked but…
it print like this
Player1, Player2,
there are end with , but there are no more player now
Use table.concat
.
local players = {}
for _,v in pairs(game.Players:GetPlayers()) do
table.insert(players, v.Name)
end
print(table.concat(players, ", "))
Thank you but there are no , between player
Thank you! it worked right now