of     1   

HeIIoISteaIUsernames
#223957679Sunday, August 20, 2017 3:01 AM GMT

Let's say you have a table that will store the amount of players local players = {} for i,v in pairs(game.Players:GetChildren()) do table.insert(players, v.Name) end but how can i track the table of players whenever someone dies? will table.remove be used in this situation?
PhoenixSigns
#223957897Sunday, August 20, 2017 3:06 AM GMT

You'll have to loop through the table to find the index corresponding to the Player's name, and then call table.remove on that index.
HeIIoISteaIUsernames
#223958103Sunday, August 20, 2017 3:10 AM GMT

can you show me how? i'm more of a visual learner
Thane_1
#223958466Sunday, August 20, 2017 3:17 AM GMT

for a,b in pairs(list) do if b==player then table.remove(list,a) end end
KapKing47
#223958615Sunday, August 20, 2017 3:20 AM GMT

I honestly hate that plain approach. What I would do in this case is... local players = {} for i, v in pairs(game.Players:GetPlayers()) do players[v] = v.Name end --Check to see when a player died players[playerThatDied] = nil
KnightmareXD
#223959634Sunday, August 20, 2017 3:40 AM GMT

I also think a hash map implementation would be better in this case.
HeIIoISteaIUsernames
#224016549Monday, August 21, 2017 4:52 AM GMT

@Kap i tried using your format but for some reason it's not working.
Quasiduck
#224017571Monday, August 21, 2017 5:30 AM GMT

Nice thinking Kap but one small error. Here is the fix: local players = {} for i, v in pairs(game.Players:GetPlayers()) do players[v.Name] = v end --Check to see when a player died players["playerThatDiedsName"] = nil
FumeiSencho
#224018062Monday, August 21, 2017 5:50 AM GMT

local livingPlayers = game.Players:GetPlayers(); for i, v in pairs(livingPlayers) do v.Character.Humanoid.Died:connect(function() table.remove(livingPlayers, i) end) end
HeIIoISteaIUsernames
#224018288Monday, August 21, 2017 5:59 AM GMT

for some reason none of this is working source code: function elimination() --eliminates the players by dying or falling into the lava for i,v in pairs(players:GetChildren()) do local hum = v.Character.Humanoid PlayerItemRemove() hum.Died:Connect(function() v.Lobby.Value = true table.remove(playersInRound,i) end) end end function roundBegin() --Begins the round StopMusicZ() roundZ() local playerlist = players:GetChildren() for i,v in pairs(playerlist) do v.PlayerGui.Main.Shop.Button.Visible = false local spawns = _G.Map:WaitForChild("Spawns"):GetChildren() v.Character:MoveTo(spawns[math.random(1,#spawns)].Position) table.insert(playersInRound, v.Name) v.Lobby.Value = false PlayerItem() end pianos.Disabled = false for i = config.Round.Value,1, -1 do im###########n##rogress") smess(i) wait(1) elimination() if i = 1 then MoreThanOneSurvivor() break elseif #playersInRound == 1 then JustOneSurvivor() break elseif #playersInRound == 0 then NoSurvivors() break end end end
KapKing47
#224083866Tuesday, August 22, 2017 6:06 PM GMT

samy, I don't see nothing wrong with using objects as index. I've used them before and they worked like a charm for me.
Quasiduck
#224084988Tuesday, August 22, 2017 6:38 PM GMT

It means you would have to later index it by going players[game.Player.etc.] when you can just do game.Players.etc. hence it defeats the purpose of using the Table really. Better to just call it from the table by it's name.
KapKing47
#224118482Wednesday, August 23, 2017 12:37 PM GMT

But ya have a reference to the player so u don't have to do game.Players.Player :P

    of     1