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

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

Asked by 5 years ago

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

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. DeceptiveCaster 3761 — 5y

2 answers

Log in to vote
0
Answered by 5 years ago

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
0
Do you know how to display player1,player2,player,3 has won? slinky22 0 — 5y
0
Make a table from the for loop lol SoftlockedUnderZero 668 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

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

Answer this question