yurhomi10Join Date: 2008-12-10 Post Count: 13886 |
no errors, i think my conditions arent right but not sure whats not right about them.
repeat wait() until _G.que and _G.sparring
que = _G.que ; spar = _G.sparring
while #que >= 2 and #spar == 0 do -- not running not sure why
wait(0.01)
print("enough players")
print(#que, #spar)
end
|
|
|
yurhomi10Join Date: 2008-12-10 Post Count: 13886 |
lol whats dirty |
|
|
yurhomi10Join Date: 2008-12-10 Post Count: 13886 |
help? |
|
|
Very interesting.
Are you certain that the variables are truly receiving the values from the global table? |
|
|
The wait(0.01) is very interesting as well, but shouldn't be the reason why it doesn't work
Try printing after the first line to check if the loop actual found the two vars |
|
yurhomi10Join Date: 2008-12-10 Post Count: 13886 |
my two tables are empty, some values are added when you click a button but i tried doing this on a test server and it just doesnt do the while loop at all, i knwo that because it doesnt print the "enough players" string. |
|
|
yurhomi10Join Date: 2008-12-10 Post Count: 13886 |
i put a print(#que, #spar) after the repeat. I got 0 and 0 but that's expected, it just doesn't do anything when both conditions are met (2 players are que'd and 0 are sparring)
|
|
|
Well if they're both 0, the while loop will never start ("while #que >= 2")
Changing que will not update the while loop, you need to start it somehow.
|
|
|
um dont use _G
i make u math.sqrt() |
|
yurhomi10Join Date: 2008-12-10 Post Count: 13886 |
But players will eventually be added into the table, like i had two test players in it and it would do nothing |
|
|
The line with the while loop won't see that because it doesn't get updated all the time |
|
yurhomi10Join Date: 2008-12-10 Post Count: 13886 |
Oh i get it now, i forgot if you store a value in a variable it will always be the same even though it changes so instead of #que i should just do #_G.que |
|
|
Yes that is true as well xd
I don't really know how to explain this..
Try
while wait() do
if _G.#que >= 2 and _G.#spar == 0
print("enough players")
print(#que, #spar)
end
end |
|
yurhomi10Join Date: 2008-12-10 Post Count: 13886 |
Hey thanks for the help i gotta go for now but will try that code later, thanks :)! |
|