I was making my game and added a winners table, when the game displays text with winners it sticks names together.
Here's the part of the script:
function changeMessage(text) local message = workspace:FindFirstChild("GameHint") if message then message.Text = text elseif not message then createMessage() end end for i,player in pairs(game.Teams.Survivors:GetPlayers()) do if game.Teams.Survivors:GetPlayers() then table.insert(winners, player.Name) end end changeMessage("Survived: ".. table.concat(winners))
I'm assuming you want a delimiter; a separator for each name.
table.concat
's second argument! It is expected to be a string, and it will just separate each table element with the specified delimiter
local function changeMessage(text) local message = workspace:FindFirstChild("GameHint") -- recommend you change this. messages and hints are deprecated! if message then message.Text = text else createMessage() end end for _, player in pairs(game.Teams.Survivors:GetPlayers()) do table.insert(winners, player.Name) end changeMessage("Survived: ".. table.concat(winners, ", ")
So say the table was {"Player1", "Player2"}, the string would look like Player1, Player2
.
I removed some unnecessary stuff too.