How do I list the names of players on a team on a textLabel?

I’m trying to list the players on a team in a textLabel. I tried using the code below but it returns the error listed under it. What would the correct method be to do this?

local players = table.concat(game.Teams.Playing:GetPlayers(), ", ")

Returns the error

 ServerScriptService.Server.gameScripts.core:71: invalid value (userdata) at index 1 in table for 'concat'

Thanks!

It’s because you’re trying to concatenate a player to a string. You’d have to use the players’ names.

local players = team:GetPlayers()
for i,v in pairs(players) do
    players[i] = v.Name
end
local players = table.concat(players, ', ')
1 Like