I’m trying to make something like this in Survive the Disasters by VyrissDev, how would I go about making this?
You would have a folder in replicateedstorage or someplace relevant and when a player dies use Instance.new to add a plyers name into the folder. Then, when the round ends, add the rest of the players names to a dictionary and print it out.
I will assume you are referring to the formatting of the text where each player is separated by a comma?
You can do this several ways.
Example Table Structure
local playersAliveNamesTable = {"Bill","Bob","Susan"}
local playersAliveText = ""
for i,Name in ipairs(playersAliveNamesTable) do
playersAliveText = playersAliveText .. ", ".. Name
end
or
local playersAliveText = table.concat(playersAliveNamesTable,", ")
Both will have the same output of
Bill, Bob, Susan
2 Likes
Sounds simple enough, and how would I go about doing the “and” part separating from the rest of the players? (e.g “and epikawesomecoolguy”)
Remove the last player from the table and manually add it using an " and" instead of a ", "
or something like this
local playersAliveText = ""
for i,Name in ipairs(playersAliveNamesTable) do
if i < #playersAliveNamesTable then
playersAliveText = playersAliveText .. ", ".. Name
else
playersAliveText = playersAliveText .. ", and ".. Name
end
end
Bill, Bob, and Susan
1 Like