|
| 05 Feb 2012 05:22 PM |
is there a better way to check if players are alive or not in a period of time? Normally i would just have a global table like: _G["Alive"] = {all, of, the, players} and then remove the player from the table when they die via a script inside their character... i want to know if there is a way to check if a player has died without creating a script for each individual player...
tl;dr
is there a way to check if a player has died with out creating a script for each player?
~I script Awesome sauce to go with my spaghetti code |
|
|
| Report Abuse |
|
|
|
| 05 Feb 2012 05:27 PM |
| You're in my group, Y U NO ASK PEOPLE IN IT. |
|
|
| Report Abuse |
|
|
|
| 05 Feb 2012 05:37 PM |
the question seemed better fitted for the forums? i dunno :P
~I script Awesome sauce to go with my spaghetti code |
|
|
| Report Abuse |
|
|
|
| 05 Feb 2012 05:39 PM |
| Put a BoolValue in the player on entered and make a script check all the players and bool value, try using the i, v method! |
|
|
| Report Abuse |
|
|
|
| 05 Feb 2012 05:43 PM |
Names = game.Players:GetChildren() for i, v in ipairs (game.Players[Names].Alive do script.Parent.Text = i.." player(s) left!"
I think you would do it that way. Then get a script like a leader board but instead a BoolValue named Alive. |
|
|
| Report Abuse |
|
|
|
| 05 Feb 2012 05:48 PM |
well, yours doesn't really solve the problem of multiple scripts. since i still have to use the .Died event on each player.
This is what i'm doing. -----------script 1------------------------- _G["Alive"] = {}
for i,v in pairs (game.Players:GetPlayers()) do table.Insert(_G["Alive"] ,v) end --------script inside PlayerGui----------- player = script.Parent.Parent.Character player.Humanoid.Died:connect(function() for i = 1,#_G["Alive"] do if _G["Alive"][i] == player.Name then table.remove(_G["Alive"],i) end end --------------------------------------------
~I script Awesome sauce to go with my spaghetti code |
|
|
| Report Abuse |
|
|
|
| 05 Feb 2012 05:49 PM |
woops i missed an 'end)' on the last script.
~I script Awesome sauce to go with my spaghetti code |
|
|
| Report Abuse |
|
|
|
| 05 Feb 2012 07:06 PM |
bawmp
~I script Awesome sauce to go with my spaghetti code |
|
|
| Report Abuse |
|
|
|
| 05 Feb 2012 08:28 PM |
o____________________o
~I script Awesome sauce to go with my spaghetti code |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2012 01:39 PM |
could i do something like?
for i,v in pairs(game.Players:GetPlayers()) do v.Character.Humanoid.Died:connect(function() print("umg, "..v.." just died D:") end) end
~I script Awesome sauce to go with my spaghetti code |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2012 01:54 PM |
Wait what? Multiple scripts?
[Gamer for life] |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2012 02:01 PM |
i'm just wondering if i have to clone a script into each player. Each script would remove the player from the global table when they die. I just wanted to know if i could do that all with one script.
~I script Awesome sauce to go with my spaghetti code |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2012 02:02 PM |
All in one script of course.
[Gamer for life] |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2012 02:03 PM |
Why not integrate a died event in the leader-board? That's what I did.
† KMXD † |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2012 02:09 PM |
I'm just making this for a friend. I wanted to put as much as i can in one script to avoid any confusion, but anywho.... What do you mean by intergrating the died event with the leaderboard? Would it just work like:
game.Players.PlayerAdded:connect(function(player) wait() player.Character.Humanoid.Died:connect(function() print("nuuu you died D:") end) end)
~I script Awesome sauce to go with my spaghetti code |
|
|
| Report Abuse |
|
|
|
| 06 Feb 2012 02:10 PM |
Ehm, something like that.
† KMXD † |
|
|
| Report Abuse |
|
|