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: How would you do this?

Previous Thread :: Next Thread 
JustScary is not online. JustScary
Joined: 03 Sep 2015
Total Posts: 1765
18 Jan 2016 06:15 PM
So, in my game players are teleported to an arena to fight with swords.

But I'm lacking something pretty big.

When everyone dies, the game keeps playing for the rest of the time.

So how do you make it that if only 1 person is alive, or 0 people are alive, then the game breaks the script?

while true do
break
end

^ like that break only with the if, then statement to make it so that if one or 0 people are alive, it breaks?

Thanks for helping
Report Abuse
JustScary is not online. JustScary
Joined: 03 Sep 2015
Total Posts: 1765
18 Jan 2016 06:19 PM
b
Report Abuse
128Gigabytes is not online. 128Gigabytes
Joined: 17 Apr 2014
Total Posts: 3616
18 Jan 2016 06:25 PM
Make a table with every player in the table and keep track of if someones humanoid dies, their character respawns, or they leave the game
If one of those happens, remove their name from the table.

Then in your countdown do this

for x = 300, 0, -1 do
if (#tableOfPeople > 0) then
wait(1)
--[[Do other timer stuff I guess, like updating a display]]
else
break;
end
end
Report Abuse
JustScary is not online. JustScary
Joined: 03 Sep 2015
Total Posts: 1765
18 Jan 2016 06:27 PM
^ good idea but how would I make a table?
Report Abuse
128Gigabytes is not online. 128Gigabytes
Joined: 17 Apr 2014
Total Posts: 3616
18 Jan 2016 06:31 PM
Do you know what a table is?
In short; its a list

Roblox has a method under game.Players for getting a table of all the players in the game

local people = game.Players:getPlayers()

Although I would prefer to keep the values as a string like this

local people = {}
for _, player in next, game.Players:getPlayers() do
table.insert(people, player.Name)
end
Report Abuse
JustScary is not online. JustScary
Joined: 03 Sep 2015
Total Posts: 1765
18 Jan 2016 10:12 PM
^ I heard to use a table again.

Where would I put that code? In the global scope or just local?
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