|
| 12 Dec 2012 06:23 AM |
function DeathMatch() _G.Message("Fight to the death!") count = 0 for i = 1, #p do if p[i].Character:FindFirstChild("Playing") then count = count + 1 end end end
repeat DeathMatch() until count <= 1
~SamuelKingx |
|
|
| Report Abuse |
|
|
RoflBread
|
  |
| Joined: 18 Jun 2009 |
| Total Posts: 3803 |
|
|
| 12 Dec 2012 06:33 AM |
| Eeeee, output? What's the error? |
|
|
| Report Abuse |
|
|
|
| 12 Dec 2012 08:11 AM |
| Did you ever define table 'p'? |
|
|
| Report Abuse |
|
|
|
| 12 Dec 2012 09:55 PM |
| Yes, p = game.Players:GetChildren() |
|
|
| Report Abuse |
|
|
|
| 12 Dec 2012 09:56 PM |
| For some reason, when it gets to this part of the script, it randomly freezes and shows no ouput whatsoever. |
|
|
| Report Abuse |
|
|
|
| 12 Dec 2012 09:58 PM |
| Because you never RESET count, so it keeps adding count+1 for every Player, every time You loop it. |
|
|
| Report Abuse |
|
|
|
| 12 Dec 2012 09:59 PM |
function DeathMatch() _G.Message("Fight to the death!") local count = 0 for i, v in pairs(p) do if p[i].Character:FindFirstChild("Playing") then count = count + 1 end end end repeat DeathMatch() and wait() until count <= 1
Maybe? Do you determine if people are playing by checking Playing's value, or it's existence?
¤ † KMXD† ¤
|
|
|
| Report Abuse |
|
|
|
| 13 Dec 2012 03:43 PM |
| Knight, wouldn't it error since count is local to the Function only? |
|
|
| Report Abuse |
|
|
jelly134
|
  |
| Joined: 25 Aug 2008 |
| Total Posts: 1137 |
|
|
| 13 Dec 2012 03:45 PM |
| Remove local and give it a try. |
|
|
| Report Abuse |
|
|
|
| 13 Dec 2012 03:48 PM |
Either a) p is undefined b) FindFirstChild returned 'false' c) _G.Message is nil |
|
|
| Report Abuse |
|
|
|
| 13 Dec 2012 03:48 PM |
count = 0 while count > 0 do wait() _G.Message("Fight to the death!") for i = 1, #p do if p[i].Character:FindFirstChild("Playing") then count = count + 1 end end if count < 1 then break end end print("ALL PLAYERS DIED")
-- Try that and see.
|
|
|
| Report Abuse |
|
|
| |
|
|
| 13 Dec 2012 03:52 PM |
Actually, you may need a 'wait' there. If the three things I listed check out, then I bet you a 'wait' will fix it.
function DeathMatch() _G.Message("Fight to the death!") count = 0 for i = 1, #p do if p[i].Character:FindFirstChild("Playing") then count = count + 1 end end end repeat DeathMatch() Wait(0.2) until count <= 1 -- Wait added here |
|
|
| Report Abuse |
|
|
Voxhall
|
  |
| Joined: 22 Apr 2009 |
| Total Posts: 21504 |
|
| |
|
jelly134
|
  |
| Joined: 25 Aug 2008 |
| Total Posts: 1137 |
|
|
| 13 Dec 2012 03:55 PM |
| This isn't meet and greet forum |
|
|
| Report Abuse |
|
|
|
| 13 Dec 2012 08:22 PM |
Thanks crazy, I'll try that out and see if it work, but I think the main problem was that "count" was local to that function.
~SamuelKingx |
|
|
| Report Abuse |
|
|
|
| 14 Dec 2012 07:44 PM |
Crazyman, it still didn't work. If you get a chance/ever come back to this thread, please message me and I'll tell you what's going on.
~SamuelKingx |
|
|
| Report Abuse |
|
|
|
| 14 Dec 2012 08:39 PM |
UMG STOLE MY SCRIPT D:< :P
~LUV, LuaLearners Teacher(+2)~ |
|
|
| Report Abuse |
|
|
|
| 14 Dec 2012 09:37 PM |
Nut uhh, nub . :P
~SamuelKingx |
|
|
| Report Abuse |
|
|