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
|
  |
| Joined: 26 Oct 2008 |
| Total Posts: 2609 |
|
| |
|
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
|
  |
| Joined: 26 Oct 2008 |
| Total Posts: 2609 |
|
| |
|
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 |
|
|
|
| 09 Aug 2012 06:06 AM |
game.Players[math.random(1,#game.Players:GetPlayers())] |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|