I've mostly figured out how to make a system to announce just one winner, but what about multiple. Background: I am making a minigames game, and different minigames have different types. I am going to explain two types here: Survival and OneSurvival. OneSurvival means that the last person left alive in the minigame will win, and their name will be announced. Survival means that everyone has to survive until the end, and if everyone dies before times up, it will be announced that there are no survivors. However, multiple people can survive in a Survival type minigame. Here is a code snippit:
function DoGame() local map = workspace.CurrentMap:FindFirstChildWhichIsA("Model") local roundlength = map:FindFirstChild("Time").Value local canwin = true if map:FindFirstChild("Type").Value == "Survival" then message.Value = "Time left: "..roundlength wait(1) repeat roundlength = roundlength - 1 message.Value = "Time left: "..roundlength until roundlength == 0 or #workspace.InGame:GetChildren() == 0 if #workspace.InGame:GetChildren() == 0 then message.Value = "No one has won :(" wait(3) end end end****
Here's some more context. "InGame" is a folder within the workspace that all players currently playing the minigame are in. I need a line in this script that will announce all the names of the survivors if there are multiple people alive when time is up. If you need more context, ask.
To elaborate on my comment to MrCatDoggo's answer, string concatenation through tables looks like this:
local t = {} for i, c in ipairs(workspace.InGame:GetChildren()) do t[i] = c.Name end message.Value = "Survivors: " .. table.concat(t, ", ")
Notes:
ipairs
over `pairsPlayer1
or Player1, Player2
or Player1, Player2, Player3
)I don't know if theres a quick way to do this, but I'd use this as a work around, in the appropiate place of course:
else local New = Instance.new("StringValue", workspace) for i,v in pairs(workspace.InGame:GetChildren()) do New.Value = New.Value .. v.Name .. ", " end message.Value = "The survivors were: " .. New.Value end
As said, this is a workaround as idk if theres something you can script manually for this