| |
|
|
| 17 Feb 2017 01:22 AM |
| for i,v in pairs(game.Players:GetChildren()) do if # then if ########### then if ########### and ###################################### and ########################### > 0 then local human = #################### human.Died:connect(function() if # then survivors = survivors - 1 end end) survivors = survivors + 1 end end game.Players.PlayerRemoving:connect(function(plr) print(plr.Name..' left') survivors = survivors - 1 end) end end |
|
|
| Report Abuse |
|
|
|
| 17 Feb 2017 01:24 AM |
for i,v in pairs(game.Players:GetChildren()) do if v then if v.Character then --if statement FOR THE CHARACTER local human = v.Character.Humanoid human.Died:connect(function() if v then survivors = survivors - 1 end end) survivors = survivors + 1 --end end game.Players.PlayerRemoving:connect(function(plr) print(plr.Name..' left') survivors = survivors - 1 end) end end |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
|
| 17 Feb 2017 02:15 PM |
| I can't just use an if statement I just need it to be attached to the one player as with this method it fires like 50 times and I just need it to fire once for that specific player. |
|
|
| Report Abuse |
|
|
|
| 17 Feb 2017 02:19 PM |
Part of the reason nobody's helping is the script snippet you posted as the first reply got hit rather hard by tags. Try reposting it, or failing that, provide us with a PasteBin ID.
|
|
|
| Report Abuse |
|
|
|
| 17 Feb 2017 02:20 PM |
| Or you can scroll down a bit, to see the script. |
|
|
| Report Abuse |
|
|
|
| 17 Feb 2017 02:22 PM |
Because it's within a loop.
|
|
|
| Report Abuse |
|
|
| |
|
|
| 17 Feb 2017 02:25 PM |
That works too.
What happens if you print(v) at various loop levels? Like before Humanoid.Died, for example, and before all "if(v) then"?
|
|
|
| Report Abuse |
|
|
|
| 17 Feb 2017 02:27 PM |
(note doing what I suggest may result in errors, you'll want to use print("Value: " ..v.. "") in order to convert the value to a String.)
|
|
|
| Report Abuse |
|
|
|
| 17 Feb 2017 02:28 PM |
| why on earth can't you just use an if statement? |
|
|
| Report Abuse |
|
|
| |
|
|
| 17 Feb 2017 02:59 PM |
| Also .Died works perfectly fine, I just need this. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 17 Feb 2017 03:43 PM |
you dont put the connection inside the for loop.
|
|
|
| Report Abuse |
|
|
|
| 17 Feb 2017 03:48 PM |
for i,v in pairs(game.Players:GetChildren()) do if v then if v.Character then --if statement FOR THE CHARACTER local human = v.Character.Humanoid human.Died:connect(function() if v then survivors = survivors - 1 end end) survivors = survivors + 1 --end end game.Players.PlayerRemoving:connect(function(plr) print(plr.Name..' left') survivors = survivors - 1 end) end end |
|
|
| Report Abuse |
|
|
| |
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 17 Feb 2017 04:04 PM |
did u not read that i said
|
|
|
| Report Abuse |
|
|
|
| 17 Feb 2017 04:04 PM |
for i,v in pairs(game.Players:GetChildren()) do if v then if v.Character then --if statement FOR THE CHARACTER local human = v.Character.Humanoid human.Died:connect(function() if v then survivors = survivors - 1 end end) survivors = survivors + 1 --end end end end
game.Players.PlayerRemoving:connect(function(plr) print(plr.Name..' left') survivors = survivors - 1 end)
only fires for one person...
|
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 17 Feb 2017 04:06 PM |
| for i,v in next, game.Players:GetPlayers() do survivors = survivors + 1 local human = #################################### human.Died:connect(function() survivors = survivors - 1 end) end game.Players.PlayerRemoving:connect(function(player) print(player,' left') survivors = survivors - 1 end) |
|
|
| Report Abuse |
|
|
|
| 17 Feb 2017 04:06 PM |
for i,v in pairs(game.Players:GetChildren()) do if v then if v.Character then --if statement FOR THE CHARACTER local human = v.Character.Humanoid human.Died:connect(function() if v then survivors = survivors - 1 end end) survivors = survivors + 1 --end end end end
game.Players.PlayerRemoving:connect(function(plr) print(plr.Name..' left') survivors = survivors - 1 end)
Try that, it will only fire for the players that where in the game when the loop started.
|
|
|
| Report Abuse |
|
|