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 to see if all players are dead

Previous Thread :: Next Thread 
theDEVILjsb is not online. theDEVILjsb
Joined: 01 May 2012
Total Posts: 158
05 Feb 2016 05:22 PM
I want to know how to make a script that checks if all players are dead

schmipitty schmop
Report Abuse
zaniac10 is not online. zaniac10
Joined: 18 Aug 2009
Total Posts: 10000
05 Feb 2016 05:24 PM
for _,v in pairs(game.Players:GetChildren()) do
if v.Character.Humanoid.Health == 0 then

end
end
Report Abuse
theDEVILjsb is not online. theDEVILjsb
Joined: 01 May 2012
Total Posts: 158
05 Feb 2016 06:04 PM
Thanks

schmipitty schmop
Report Abuse
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
05 Feb 2016 06:09 PM
btw his script won't work for what you are doing


Report Abuse
zaniac10 is not online. zaniac10
Joined: 18 Aug 2009
Total Posts: 10000
05 Feb 2016 06:09 PM
yea i realized it after it'll do it even if only one person is dead
Report Abuse
zaniac10 is not online. zaniac10
Joined: 18 Aug 2009
Total Posts: 10000
05 Feb 2016 06:10 PM
i realized it after i posted*
Report Abuse
theDEVILjsb is not online. theDEVILjsb
Joined: 01 May 2012
Total Posts: 158
05 Feb 2016 06:25 PM
Yeah, because all the players respawn

schmipitty schmop
Report Abuse
theDEVILjsb is not online. theDEVILjsb
Joined: 01 May 2012
Total Posts: 158
05 Feb 2016 06:26 PM
Can I do something like make a spectating team, and have a script that sees if all players from a team are in that team?

schmipitty schmop
Report Abuse
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
05 Feb 2016 06:30 PM
You need to keep track of the players in the game.
I suggest you add their name to a table when you teleport them(assuming you tp them)
when they die remove them from the table
wait until #table == 0


Report Abuse
theDEVILjsb is not online. theDEVILjsb
Joined: 01 May 2012
Total Posts: 158
05 Feb 2016 06:45 PM
I have no idea how to do any of that.. :(
You're helping a lot though, just that I'm not that experienced in scripting

schmipitty schmop
Report Abuse
theDEVILjsb is not online. theDEVILjsb
Joined: 01 May 2012
Total Posts: 158
06 Feb 2016 11:51 AM
Never mind, that's not how I'm going to do it.

schmipitty schmop
Report Abuse
128Gigabytes is online. 128Gigabytes
Joined: 17 Apr 2014
Total Posts: 3616
06 Feb 2016 12:22 PM
Have a gui pop up and ask them if they died.

Joking of course,
Call the function revive to put everyone back in the table of 'alive' and to start the checks for death to remove them from the table.


local alive = {}

local function revive()
for key, _ in next, (alive) do
alive[key] = nil;
end
for _, player in next, (game.Players:getPlayers()) do
alive[player] = 0;
local died;
died = (player.Character or player.Character.characterAdded:wait()):waitForChild("Humanoid").died:connect(function()
alive[player] = nil;
died:disconnect()
end)
end
end

game.Players.playerRemoving:connect(function(player)
alive[player] = nil;
end)


--[[Example.]]

local message = Instance.new("Message", workspace)
while true do
wait(1)
revive()
for _ = 1, 32, 1 do
wait(1)
message.Text = "Players alive;"
for player, _ in next, (alive) do
message.Text = (message.Text .. " " .. player.Name)
end
end
end
Report Abuse
theDEVILjsb is not online. theDEVILjsb
Joined: 01 May 2012
Total Posts: 158
07 Feb 2016 02:42 PM
I don't need to do that anymore, but thanks. I do need to sort the teams when every round starts though.

schmipitty schmop
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