C_SharperJoin Date: 2011-10-03 Post Count: 9405 |
local minigames = {}
local h = Instance.new("Hint",game.Workspace)
while true do
wait()
if game.Players.NumPlayers >= 1 then
wait(95555)
h.Text = "Enough players! Starting game.."
else
h.Text = "We need one more player to start."
end
end
I am testing it in studio, the "else" will not work, but it did when I ran it by clicking on the green arrow. |
|
|
Where are you running it from?
If its not edit mode, then that if will never be false, so that else will never run; try changing >= 1 to >= 2 in the if
mmm cats |
|
jd678Join Date: 2008-04-18 Post Count: 11529 |
" >= 1 "
you are checking if there are 1 or more players, so there would have to be 0 players for the 'else' to fire.
change it to ' > 1 ' |
|
C_SharperJoin Date: 2011-10-03 Post Count: 9405 |
I figured it out, "else" was listed under the function, it should have been under the end. Thanks though |
|
|
Oh god... why do you have 12 straight lines of blank space? D:
Anywho, your problem is that IF there's enough players, the game waits 1 day, 2 hours and 24 minutes (if my math is right). Try making that number lower. If that doesn't work, post your output?
Also, just to confirm, the intention of this script (so far) is to make a message say if there's 1 *OR* more players in the game, right?
Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson |
|
C_SharperJoin Date: 2011-10-03 Post Count: 9405 |
No, it says it needs another end.
Bump |
|
jd678Join Date: 2008-04-18 Post Count: 11529 |
still won't work unless you change the if, unless you have a game with 0 players in it |
|
C_SharperJoin Date: 2011-10-03 Post Count: 9405 |
This is insane, you guys arn't listening to me.
The first part works.
It is with the "else" statement. It will not say "Needs another player"
Look below the script |
|
C_SharperJoin Date: 2011-10-03 Post Count: 9405 |
Oh gosh, lost my brain for a sec there. You were right. It was with the timing.
Much appreicated |
|
|
Scripts can deceive you.
The problem can appear to be in one part, yet be in a completely different part.
The reason the else will not fire is because the if cannot be false.
Change it to > 1 and it will work.
mmm cats |
|
|
Read my post before complaining about us not reading yours. I told you the reason its not working, its checking if there's 1 or more players (which there probably will be, if you're testing it), then waiting over a day (meaning that you don't go back to the if statement again for a whole day).
Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson |
|
C_SharperJoin Date: 2011-10-03 Post Count: 9405 |
The player num wasn't causing it.
It was the "wait"
|
|
jd678Join Date: 2008-04-18 Post Count: 11529 |
It's exactly what L2k said.
the if is always true, so the else CANNOT FIRE unless the if is FALSE
You have it set to >=1 when it needs to be > 1 |
|
jd678Join Date: 2008-04-18 Post Count: 11529 |
the wait has nothing to do with the else. |
|
C_SharperJoin Date: 2011-10-03 Post Count: 9405 |
We can keep going on about this, it was the wait that caused it.
it doesn't make much sense, but It worked when I changed it to 5. |
|
|
@jd678
The wait has everything to do with his script not working. When he plays, there is automatically somebody in the game (which I'm assuming is how he's testing). Because there is somebody there, the script waits over a day before checking the if statement again.
Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson |
|
jd678Join Date: 2008-04-18 Post Count: 11529 |
Yes, but if he changed the if to > 1 then it will only fire the if when there are 2 or more players.
His game only needs 1 player to start? Then whats the point in checking for players, it's totally worthless. |
|
C_SharperJoin Date: 2011-10-03 Post Count: 9405 |
I was just testing it! Early testing... |
|
jd678Join Date: 2008-04-18 Post Count: 11529 |
repeat wait() until game.Players.NumPlayers >= 1
does EXACTLY what his script does, except it doesn't infinitely loop when a player is found |
|
jd678Join Date: 2008-04-18 Post Count: 11529 |
You can test things with players by following these steps:
Tools > Test > Start Server
--With the Server Tab selected
Tools > Test > Start Player
you can control each player, and access scripts through the server-client |
|
jd678Join Date: 2008-04-18 Post Count: 11529 |
repeat wait(1) print("Not enough Players") until game.Players.NumPlayers > 1
wait(5)
print("Game Starting!")
--is a bit more efficient btw.
|
|
C_SharperJoin Date: 2011-10-03 Post Count: 9405 |
Thanks. But I like using loops. It just seems faster to type. |
|
jd678Join Date: 2008-04-18 Post Count: 11529 |
yours is fine, sorry about the confusion. |
|
C_SharperJoin Date: 2011-10-03 Post Count: 9405 |
Ty :) |
|