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: A little help with GetChildren()

Previous Thread :: Next Thread 
bob354293 is not online. bob354293
Joined: 26 Oct 2008
Total Posts: 2609
09 Aug 2012 04:04 AM
Right, so in my game, you go in, and you get a value called alive, if this value is true you get money, if its not you don't cuz you wont be in the game, anyway, how would i use getchildren, to check if at least 1 person is still alive?
so i have a repeat thing, and i need an if after it, so if nobody has alive.value = true then end game, basically, but, i don't know:/ Pweesee help :)
Report Abuse
bob354293 is not online. bob354293
Joined: 26 Oct 2008
Total Posts: 2609
09 Aug 2012 04:11 AM
anyone?
Report Abuse
Osyris is not online. Osyris
Joined: 27 Oct 2007
Total Posts: 4321
09 Aug 2012 04:40 AM
for _,v in pairs(game.Players:GetChildren()) do
local value = v.value:FindFirstChild("alive")
if value then
" " --Stuff that happens goes here.
end
end
Report Abuse
bob354293 is not online. bob354293
Joined: 26 Oct 2008
Total Posts: 2609
09 Aug 2012 04:50 AM
one minute im confused...
Report Abuse
bob354293 is not online. bob354293
Joined: 26 Oct 2008
Total Posts: 2609
09 Aug 2012 04:53 AM
Heres the script;
repeat
wait(1)
game.Workspace.TimeLeft.Value = game.Workspace.TimeLeft.Value - 1
if game.Workspace.Won.Value == true then
game.Workspace.Dude1:remove()
game.Workspace.TimeLeft.Value = 0
-------------------------------------------------------MODIFY BELOW
for i,v in pairs(game.Players:GetPlayers()) do
if v.Alive.Value == true then
game.Workspace.TimeLeft.Value = 0
local Bux = v.leaderstats.Bux
Bux.Value = (Bux.Value + 100)
end
end
end
---------------------------------------------------- MODIFY ABOVE
until game.Workspace.TimeLeft.Value == 0

its like a game script, where theres levels and you gotta kill people to win, how would i make it so if like 1 person alive.Value = true and 5 people alive.Value = false, it keeps running, but if everyone on the server alive.Value == false then it changed timeleft.Value to 0, rather then having to wait for timeleft to run out? if you get me?
Report Abuse
FlamedSkull is not online. FlamedSkull
Joined: 23 May 2009
Total Posts: 1379
09 Aug 2012 06:06 AM




game.Players[math.random(1,#game.Players:GetPlayers())]
Report Abuse
cheatmaster18 is not online. cheatmaster18
Joined: 29 Oct 2010
Total Posts: 1871
09 Aug 2012 06:13 AM
Here is a fixed version of the script if I did it correct:

local nooneAlive = false
repeat
wait(1)
game.Workspace.TimeLeft.Value = game.Workspace.TimeLeft.Value - 1
for _,v in pairs(game.Players:GetChildren()) do
local value = v:FindFirstChild("Alive")
if v.Alive.Value == true then
else
game.Workspace.TimeLeft.Value = 0
end
end
if game.Workspace.Won.Value == true then
game.Workspace.Dude1:remove()
game.Workspace.TimeLeft.Value = 0
-------------------------------------------------------MODIFY BELOW
nooneAlive=false
for i,v in pairs(game.Players:GetPlayers()) do
if v.Alive.Value == true then
nooneAlive = false
local Bux = v.leaderstats.Bux
Bux.Value = (Bux.Value + 100)
else
nooneAlive = true
end
end
if nooneAlive then
game.Workspace.TimeLeft.Value = 0
end
---------------------------------------------------- MODIFY ABOVE
until game.Workspace.TimeLeft.Value == 0
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