local teams = game:GetService("Teams")
playingPlrs = teams.Playing:GetPlayers()
if #playingPlrs > 0 then
local playingString = table.concat(playingPlrs, ", ")
print(playingString.." won!")
else
print("Everyone lost!")
end
table.concat() takes two arguments, the first is the table which is being concatenated the second is a string value representing how to separate (delimit) each value in the table being concatenated, the function returns a string value with this string being all of the values of the table concatenated into a single string with each value being separated from one another by the specified delimiter.
local teams = game:GetService("Teams")
local playingPlrs = teams.Playing:GetPlayers()
local playingPlrsNames = {}
if #playingPlrs > 0 then
for _, player in ipairs(playingPlrs) do
table.insert(playingPlrsNames, player.Name)
end
local playingString = table.concat(playingPlrsNames, ", ")
print(playingString.." won!")
else
print("Everyone lost!")
end
For some reason I overlooked the original players array being an array of player objects not player names, the above should grab the names, insert them into a new array and concatenate that instead.