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: Pay for help, 500 robux. Easy

Previous Thread :: Next Thread 
Briicks is not online. Briicks
Joined: 03 Apr 2015
Total Posts: 1796
08 May 2016 07:37 PM
Can someone tell me how I can constantly check and see if "In" is empty, and if it is end the game?

while wait() do
local run = false --if false games not running
local In = {} --players that survived after game ends
local roundTime = 5 --time each round
local pn = 0 --players needed to start
local im = 5 --intermission time
if game.Players.NumPlayers >= pn then
for i = im,0,-1 do
wait(1)
print("games starts in "..i.." seconds")
end
run = true
else
run = false
end
while run do
print("starting game...")
for i = roundTime,0,-1 do
wait(1)
print("games ends in "..i.." seconds")
end
wait(1)
print("game has ended")
wait(5)
run = false
end

end


-Briicks
Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
08 May 2016 07:41 PM
for i,v in pairs(table) do
if v then
else

?


Report Abuse
DivinePheonix is not online. DivinePheonix
Joined: 30 Mar 2011
Total Posts: 11190
08 May 2016 07:42 PM
U could use a loop every 5 seconds or so to check if all the players u added into the In table at the start of the round are alive/ingame

Or u could check each time a character dies or player leaves.
Report Abuse
Briicks is not online. Briicks
Joined: 03 Apr 2015
Total Posts: 1796
08 May 2016 07:45 PM
^ I need it to work with my code above, also would this work?

repeat wait() until #In == 0
then if a player leaves or dies remove them from the table, if the table is empty(0) the game ends


-Briicks
Report Abuse
Entelicon is not online. Entelicon
Joined: 06 Nov 2012
Total Posts: 1002
08 May 2016 07:46 PM
while wait(5) do
if #In == 0 then
-- Empty, end game
else
-- Not empty, players still alive
end
end

Something like that?
Report Abuse
Briicks is not online. Briicks
Joined: 03 Apr 2015
Total Posts: 1796
08 May 2016 07:47 PM
i could do that but, the game wont end until all players are dead.
i need to game to be like a min and end in that time, or when all players are removed from the table.


-Briicks
Report Abuse
Entelicon is not online. Entelicon
Joined: 06 Nov 2012
Total Posts: 1002
08 May 2016 07:50 PM
what?
Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
08 May 2016 07:52 PM
i got this


local endGame = Instance.new("BoolValue",workspace)
endGame.Name = "endGame"

if #table == 0 then
if game.Workspace.endGame.Value ~=true then
game.Workspace.endGame.Value = true
end
end
if wait(90) then
if game.Workspace.endGame.Value ~=true then
game.Workspace.endGame.Value = true
end
end

game.Workspace.endGame.Changed:connect(function(val)
if val == true then
--end game
end
end)


Report Abuse
Briicks is not online. Briicks
Joined: 03 Apr 2015
Total Posts: 1796
08 May 2016 07:53 PM
What do you mean "what?"...

I want it to start the game if there are over let's say 3 players.
If there are over 3 players in the game run will be turned to true and the game will start.
All players will be put into a table, where if they are killed or leave the game they will be removed from this table.
If all the players die, or the game time ends the game is over.

If I use a while wait(5) do to check and see if all the players are dead, the game will never end due to the loop of checking to see if there are still players in the table.


-Briicks
Report Abuse
Entelicon is not online. Entelicon
Joined: 06 Nov 2012
Total Posts: 1002
08 May 2016 07:56 PM
spawn(function()

end)

That saves lives.
Report Abuse
Briicks is not online. Briicks
Joined: 03 Apr 2015
Total Posts: 1796
08 May 2016 07:57 PM
I do not want to insert anything into the game. I want everything to be run by the script.
If I where to insert stuff I'd be able to do this with no problem.


-Briicks
Report Abuse
phoenix53124 is not online. phoenix53124
Joined: 25 Feb 2009
Total Posts: 4889
08 May 2016 07:58 PM
repeat wait(10) until #n==0 --Put this on the line at which you want to stop
Report Abuse
Briicks is not online. Briicks
Joined: 03 Apr 2015
Total Posts: 1796
08 May 2016 08:07 PM
Never mind, I'll find a way.


-Briicks
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