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 » Scripting Helpers
Home Search
 

Re: checking players alive?

Previous Thread :: Next Thread 
MrgamesNwatch is not online. MrgamesNwatch
Joined: 02 Feb 2009
Total Posts: 7729
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
TheMaleScripter is not online. TheMaleScripter
Joined: 08 Nov 2009
Total Posts: 164
05 Feb 2012 05:27 PM
You're in my group, Y U NO ASK PEOPLE IN IT.
Report Abuse
MrgamesNwatch is not online. MrgamesNwatch
Joined: 02 Feb 2009
Total Posts: 7729
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
tehepicford is not online. tehepicford
Joined: 26 Aug 2011
Total Posts: 1486
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
tehepicford is not online. tehepicford
Joined: 26 Aug 2011
Total Posts: 1486
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
MrgamesNwatch is not online. MrgamesNwatch
Joined: 02 Feb 2009
Total Posts: 7729
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
MrgamesNwatch is not online. MrgamesNwatch
Joined: 02 Feb 2009
Total Posts: 7729
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
MrgamesNwatch is not online. MrgamesNwatch
Joined: 02 Feb 2009
Total Posts: 7729
05 Feb 2012 07:06 PM
bawmp

~I script Awesome sauce to go with my spaghetti code
Report Abuse
MrgamesNwatch is not online. MrgamesNwatch
Joined: 02 Feb 2009
Total Posts: 7729
05 Feb 2012 08:28 PM
o____________________o

~I script Awesome sauce to go with my spaghetti code
Report Abuse
MrgamesNwatch is not online. MrgamesNwatch
Joined: 02 Feb 2009
Total Posts: 7729
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
RATEXmegaGAMER is not online. RATEXmegaGAMER
Joined: 10 Dec 2010
Total Posts: 4046
06 Feb 2012 01:54 PM
Wait what? Multiple scripts?

[Gamer for life]
Report Abuse
MrgamesNwatch is not online. MrgamesNwatch
Joined: 02 Feb 2009
Total Posts: 7729
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
RATEXmegaGAMER is not online. RATEXmegaGAMER
Joined: 10 Dec 2010
Total Posts: 4046
06 Feb 2012 02:02 PM
All in one script of course.

[Gamer for life]
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
06 Feb 2012 02:03 PM
Why not integrate a died event in the leader-board? That's what I did.

† KMXD †
Report Abuse
MrgamesNwatch is not online. MrgamesNwatch
Joined: 02 Feb 2009
Total Posts: 7729
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
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
06 Feb 2012 02:10 PM
Ehm, something like that.

† KMXD †
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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