|
| 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
|
  |
| 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 |
|
|
| |
|
|
| 05 Feb 2016 06:09 PM |
btw his script won't work for what you are doing
|
|
|
| Report Abuse |
|
|
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
|
  |
| Joined: 18 Aug 2009 |
| Total Posts: 10000 |
|
|
| 05 Feb 2016 06:10 PM |
| i realized it after i posted* |
|
|
| Report Abuse |
|
|
|
| 05 Feb 2016 06:25 PM |
Yeah, because all the players respawn
schmipitty schmop |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 06 Feb 2016 11:51 AM |
Never mind, that's not how I'm going to do it.
schmipitty schmop |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|