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

How do i make the results show all the names of players still alive at the end of the round?

elseif i == 0 then
Status.Value = "The winner is "..plrs[1].Name break

1 comment

0

Create a for loop iterating through every player in game. For each player, make a player.Character.Humanoid.Died event listener. When a player dies, add their name to a table. At the end of the round, run a for loop through that table and every player in game. For every player not in the losers' table, add their name to a winners' table, then show each winner through another for loop.

2 answers

Depending on how you sort your groups of players, you can use Players:GetChildren() (or Players:GetPlayers() if you want) to get a table or list of all players in one server. Then you can use a for loop and an if statement to check if they are alive or not.

for _,v in pairs(game:GetService("Players"):GetChildren())do
 if true then -- Condition to seperate the players
  -- Code to execute
 end
end

2 comments

0

Do you know how to display player1,player2,player,3 has won?

0

Make a table from the for loop lol

you can add BoolValue to player when he join using PlayerAdded and change it to true when round start and to false when he died

  • You can add BoolValue to player when he join using this code (From Server)

game.PlayerAdded:Connect(function(plr) Value = Instance.new("BoolValue") Value.Parent = plr Value.Name = "Alive" end)

  • for checking Players (from Client)

for i,v in pairs(game.Players:GetPlayers()) do if v.Alive.Value == true then
--implement your leaderboard system here end end

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