generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Could Anyone?

Previous Thread :: Next Thread 
18lpickett is not online. 18lpickett
Joined: 15 Jul 2012
Total Posts: 3121
27 Nov 2014 06:29 AM
Could anyone give me a basic idea or something on how i could check that if theres 0 players on a Team that it skips a wait()?
Report Abuse
18lpickett is not online. 18lpickett
Joined: 15 Jul 2012
Total Posts: 3121
27 Nov 2014 06:41 AM
B1
Report Abuse
dragonkeeper467 is not online. dragonkeeper467
Joined: 24 Jan 2011
Total Posts: 472
27 Nov 2014 06:59 AM
http://wiki.roblox.com/index.php?title=NumPlayers

game.Players.NumPlayers

*returns a number so assign a variable to is


playernum = game.Players.NumPlayers

*keep in mind that this value can change so you may need to update the variable ever so often or before you launch a function
Report Abuse
18lpickett is not online. 18lpickett
Joined: 15 Jul 2012
Total Posts: 3121
27 Nov 2014 07:03 AM
Ok so i got NumPlayers down, so how couuld i skip a wait?
Report Abuse
dragonkeeper467 is not online. dragonkeeper467
Joined: 24 Jan 2011
Total Posts: 472
27 Nov 2014 07:03 AM
what do you mean skip a wait?
Report Abuse
18lpickett is not online. 18lpickett
Joined: 15 Jul 2012
Total Posts: 3121
27 Nov 2014 07:08 AM
Like lets say theres a Murderer Round going on (just an example). And if the Murderer Kills all the Players and Theres still time left it skips past all that time (the wait(), and restarts the round. Thats basically what im trying to do.
Report Abuse
18lpickett is not online. 18lpickett
Joined: 15 Jul 2012
Total Posts: 3121
27 Nov 2014 07:28 AM
Uh Hello? Where'd everyone go (xD)
Report Abuse
18lpickett is not online. 18lpickett
Joined: 15 Jul 2012
Total Posts: 3121
27 Nov 2014 07:40 AM
B2
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
27 Nov 2014 07:47 AM
Well the timer would be in a loop I suppose, to add a second and wait a second each iteration? Add an if statement in a loop that has the keyword "break" in it if it's true. "break" stops the loop and it will fall-through to the code beneath.

You could also have the condition in the loop as well, which is probably better, so:
while timer > 0 and #game.Teams.Team1:GetChildren > 0 do
wait(1)
timer = timer - 1
end

Not sure if that's how you'd get the number of players on a team though. I've never used ROBLOX's teams for anything.
Report Abuse
18lpickett is not online. 18lpickett
Joined: 15 Jul 2012
Total Posts: 3121
27 Nov 2014 07:55 AM
I tried this for it :

while timer > 0 and #game.("Alive Security"):GetChildren > 0 do
wait(1)
timer = timer - 1
end

As you can Imagine it didnt work (xd). But what you said Earlier, does a Break autmatically skip past a wait? If so then i just need to Determine how Many Players are on a Team, and if theres 0 to skip the wait).
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
27 Nov 2014 07:58 AM
No, break ends a loop. Like I said, you probably have a loop that's handling the timer.
Report Abuse
18lpickett is not online. 18lpickett
Joined: 15 Jul 2012
Total Posts: 3121
27 Nov 2014 08:06 AM
So what was wrong with my above Script?
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
27 Nov 2014 08:09 AM
"Alive Security" is a child of "Teams", first of all. You also did not initialize "timer" I'm guessing, and like I said, I'm not sure if you can get the number of players on a team by getting the number of entries in the table GetChildren() returns when called on the team.
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
27 Nov 2014 08:10 AM
I accidentally forgot the parenthesis that come after the method, so I suppose I'll rewrite it for you.

local timer = 5

while timer > 0 and #game.Teams["Alive Security"]:GetChildren() > 0 do
wait(1)
timer = timer - 1
end
Report Abuse
18lpickett is not online. 18lpickett
Joined: 15 Jul 2012
Total Posts: 3121
27 Nov 2014 08:20 AM
I tried this but 1 issue. It didnt do a wait of 70, it just skipped over it and went right on to the next line. Also it took no care in how many players were in alive security. Would i have to make the timer a wait?
Heres what i used :

local timer = 70

while timer > 0 and #game.Teams["Alive Security"]:GetChildren() > 0 do
wait(1)
timer = timer - 70
end

Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
27 Nov 2014 08:36 AM
local timer = 70

while timer > 0 and #game.Teams["Alive Security"]:GetChildren() > 0 do
wait(1)
timer = timer - 1 --subtract ONE second from the timer
end

If this code is running before there are any players on "Alive Security" than it's going to skip right over this loop.
Report Abuse
18lpickett is not online. 18lpickett
Joined: 15 Jul 2012
Total Posts: 3121
27 Nov 2014 08:42 AM
Ok so i did what you did @Above, but it just skips over the line of code.
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
27 Nov 2014 08:44 AM
"If this code is running before there are any players on "Alive Security" than it's going to skip right over this loop."
Report Abuse
18lpickett is not online. 18lpickett
Joined: 15 Jul 2012
Total Posts: 3121
27 Nov 2014 08:53 AM
I this the only way for this to work?
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
27 Nov 2014 08:56 AM
Well it should be in your game script, which should be waiting for there to be enough players. I don't think you know exactly what you're doing to do all that though, and I'm not going to do it for you.
Report Abuse
18lpickett is not online. 18lpickett
Joined: 15 Jul 2012
Total Posts: 3121
28 Nov 2014 09:55 AM
B3
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image