Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

How do I make a Survivors GUI at the end of a round?

Asked by 10 years ago

How do I make a Survivors GUI at the end of a round? You know like in those Survive the Disasters Games.

2 answers

Log in to vote
1
Answered by
Azarth 3141 Moderation Voter Community Moderator
10 years ago

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.
Ad
Log in to vote
0
Answered by
Kozero 120
10 years ago

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.

Answer this question