ixClassic
|
  |
| Joined: 16 Jun 2012 |
| Total Posts: 445 |
|
|
| 11 Apr 2014 11:01 PM |
I made a script that works: while true do wait(10) chicken = game.Players:GetChildren() for _ = 1, #chicken do chicken[_].Character.Humanoid.Health = 0 end end
But why wouldn't this work? while true do wait(10) chicken = game.Players:GetPlayers()--Difference is right here for _ = 1, #chicken do chicken[_].Character.Humanoid.Health = 0 end end |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 11 Apr 2014 11:02 PM |
| It should work, is there an output |
|
|
| Report Abuse |
|
|
ixClassic
|
  |
| Joined: 16 Jun 2012 |
| Total Posts: 445 |
|
|
| 11 Apr 2014 11:04 PM |
| Yea but it doesn't say anything, I started a server, but only the first one works. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 11 Apr 2014 11:05 PM |
| Try adding a print(unpack(chicken)) right after you define it for both. Is there anything in the second script? |
|
|
| Report Abuse |
|
|
ixClassic
|
  |
| Joined: 16 Jun 2012 |
| Total Posts: 445 |
|
|
| 11 Apr 2014 11:06 PM |
| No it's one script, I just traded the code and started new servers. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 11 Apr 2014 11:09 PM |
No wonder why...
The first loop is infinite and is not going to reach the next. |
|
|
| Report Abuse |
|
|
ixClassic
|
  |
| Joined: 16 Jun 2012 |
| Total Posts: 445 |
|
|
| 12 Apr 2014 12:10 AM |
No, that's not it. I put one script into the game at a time, then put the other, and test it. Only one script works. Just the second one doesn't seem to work.
|
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 12 Apr 2014 12:14 AM |
Try the second one alone. Because that is 1 problem, and should be the only problem in theory. |
|
|
| Report Abuse |
|
|
ixClassic
|
  |
| Joined: 16 Jun 2012 |
| Total Posts: 445 |
|
|
| 12 Apr 2014 12:15 AM |
| 1st one kills players every 10 seconds, second one kills them once then does nothing... And the output is empty. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 12 Apr 2014 12:18 AM |
| I'm saying only put the second one in the game and test it (completely remove the one with GetChildren) |
|
|
| Report Abuse |
|
|
ixClassic
|
  |
| Joined: 16 Jun 2012 |
| Total Posts: 445 |
|
| |
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 12 Apr 2014 12:21 AM |
Well the only difference between getplayers and getchildren is that getplayers only gets objects with the classname of player, so that shouldn't be causing the problem.
Try this:
while true do wait(10) local chicken = game.Players:GetPlayers() for _ = 1, #chicken do chicken[_].Character.Humanoid.Health = 0 end end |
|
|
| Report Abuse |
|
|
ixClassic
|
  |
| Joined: 16 Jun 2012 |
| Total Posts: 445 |
|
|
| 12 Apr 2014 12:27 AM |
| Alright i'll have to wait until tomorrow, i'll let you know if it works! |
|
|
| Report Abuse |
|
|