Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can I convert a table with player names into string value?

I have no code because I have no idea where to even begin-

I have a string value named "winners" which should hold all of the player names in the table, and a table that holds player names.

How do I put ALL of the player names into the string value- rather than just one?

1 comment

0

concatenate everything into a single string then match the string if you want to access it

2 answers

✓ Accepted answer

You can use string table.concat(table<string> strings [, string seperator = "", string start = 1, string end = #]) which will take a table that only contains strings e.g. {"Logophilic", "SynthetickDev"} and you can then give it a seperator that it will put between each string within the table. You can also specify a start index and an end index which tells it what strings to concatenate. It will then return a string value of the concatenated strings.

Example code:

local Players = {"Logophilic", "SynthetickDev"}

print(table.concat(Players, " and ")) -- Output: Logophilic and SynthetickDev

Hope this helps!

You can do something like this

local table = {

for i,Player in pairs(game.Players:GetPlayers()) do
	if Player.folder.WinnerValue == true then
	"Player,"..Player.Name.. -- something that would put it to the table
					--idk how u want to do it but you basically get the players name and if u want you can print it or something
end

}
	

This discussion is preserved as it was. New answers, comments, and votes are closed.