elseif gamemode==2 then
)01 | function getWinningTeamString() |
02 | local red = 0 |
03 | local blue = 0 |
04 |
05 | local players = game.Players:GetChildren() |
06 | local a = 0 |
07 |
08 | if gamemode = = 1 then |
09 | for i = 1 ,#players do |
10 | if (players [ i ] .TeamColor = = game.Teams:FindFirstChild( "BLUE TEAM" ).TeamColor) then |
11 | if (players [ i ] :FindFirstChild( "leaderstats" ) and players [ i ] .leaderstats:FindFirstChild( "Kills" )) then |
12 | blue = blue + players [ i ] .leaderstats:FindFirstChild( "Kills" ).Value |
13 | end |
14 | end |
15 |
01 | while true do |
02 | players = game:GetService( "Players" ):GetChildren() |
03 | repeat wait( 1 ) do end until #players> = 2 |
04 | gamemode = 2 --math.random(1,2) |
05 | if gamemode = = 1 then |
06 | gamestart(mapstorage.TDM:GetChildren()) |
07 | elseif gamemode = = 2 then |
08 | gamestart(mapstorage.FFA:GetChildren()) |
09 | end |
10 | wait(game_length- 30 ) |
11 | messageEvent:FireAllClients( "30 seconds left until the end of this round!" , 5 ) |
12 | script [ "30seconds" ] :Play() |
13 | wait( 30 ) |
14 | messageEvent:FireAllClients(getWinningTeamString(), 30 ) -- right here btw |
15 | -- i cut off the rest since theres no point in displaying it |
What you need to do is index the player in your for loop, and then index its properties.
1 | local Players = game:GetService( "Players" ):GetPlayers() |
2 |
3 | for i = 1 , #Players do |
4 | local plr = Players [ i ] |
5 | local leaderstats = plr:FindFirstChild( "leaderstats" ) |
6 | if leaderstats then |
7 | local kills = leaderstats:FindFirstChild( "Kills" ) |
8 | end |
9 | end |
All you will need to do to index the player's name is plr.Name
.