How do I make a Survivors GUI at the end of a round? You know like in those Survive the Disasters Games.
✓ ANSWER ACCEPTED
How do I make a Survivors GUI at the end of a round?
2 answers
✓ Accepted answer
I can get you started, but I won't do the whole thing for you since it's against the rules and it doesn't help you learn.
local survivors = {}
-- Table to hold all the survivors
for i,v in pairs(game.Players:GetPlayers()) do -- Loop through players
if v.TeamColor == BrickColor.new("Bright yellow") then
-- We need something to distinguish dead player's from survivors.
table.insert(survivors,v.Name)
-- Insert their name if they adhere to the requirement in the if statement.
end
end
print(table.concat(survivors, ","))
-- Print all of the players in the table and separate their names by commas.
You would need to learn how to use tables for this.When the round begins everyone's name in the game would be inserted into a table and every-time someone dies their name is removed from the table until it reaches one player.Then you print the winner like this and it'll appear in the output.
Players={}
for i,v in pairs (Players)
print ("The winner is",..,v)
If you want to learn more about tables I recommend PigHead10's Lua tutorial from YouTube or send me your Skype for some Word docs that were from the site Lua Learners that has been shut down recently.
This discussion is preserved as it was. New answers, comments, and votes are closed.
