xLink123
|
  |
| Joined: 07 Aug 2014 |
| Total Posts: 11158 |
|
|
| 16 May 2015 10:00 PM |
game.Players.PlayerAdded:connect(function(player) local bool = Instance.new("BoolValue", player) bool.Name = "Alive" if player.Character then StartGame() end end)
function ResetGame() for i, v in pairs(game.Players:GetChildren()) do v:LoadCharacter() end game.Workspace.Disaster = "" LivingPlayers = {} end
function StartGame() for i, v in pairs(game.Players:GetPlayers()) do local val = v:FindFirstChild("Alive") val.Value = true end end
the player added function should call the StartGame() function right? and it should then change the Alive value to true? |
|
|
| Report Abuse |
|
|
xLink123
|
  |
| Joined: 07 Aug 2014 |
| Total Posts: 11158 |
|
|
| 16 May 2015 10:01 PM |
ignore the ResetGame() function
|
|
|
| Report Abuse |
|
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
| |
|
xLink123
|
  |
| Joined: 07 Aug 2014 |
| Total Posts: 11158 |
|
| |
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 16 May 2015 10:12 PM |
| Hmmm... What does the output say? |
|
|
| Report Abuse |
|
|
|
| 16 May 2015 10:13 PM |
It should, but it won't; unless the character spawns instantaneously.
game.Players.PlayerAdded:connect(function(player) local bool = Instance.new("BoolValue", player) bool.Name = "Alive" player.CharacterAdded:wait() StartGame() end) |
|
|
| Report Abuse |
|
|
vacha
|
  |
| Joined: 06 Jan 2011 |
| Total Posts: 1993 |
|
|
| 16 May 2015 10:17 PM |
Why not create a table of all the players and remove them from the list as they die?
while true do the do |
|
|
| Report Abuse |
|
|
xLink123
|
  |
| Joined: 07 Aug 2014 |
| Total Posts: 11158 |
|
|
| 16 May 2015 10:23 PM |
| I was doing that earlier, but then someone told me this way would be better.. |
|
|
| Report Abuse |
|
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 16 May 2015 10:25 PM |
| Well, I think vacha's way is actually better. It might work that way... |
|
|
| Report Abuse |
|
|
vacha
|
  |
| Joined: 06 Jan 2011 |
| Total Posts: 1993 |
|
|
| 16 May 2015 10:26 PM |
if val then --Runs if it finds "val" val.Value = true else --Creates a new value if doesn't find "val" local val = Instance.new("BoolValue",player) val.Value = true end
while true do the do |
|
|
| Report Abuse |
|
|
xLink123
|
  |
| Joined: 07 Aug 2014 |
| Total Posts: 11158 |
|
|
| 16 May 2015 10:31 PM |
I do think a script that has a table with players in it is easier,
I can picture bugs already with the other way |
|
|
| Report Abuse |
|
|
vacha
|
  |
| Joined: 06 Jan 2011 |
| Total Posts: 1993 |
|
|
| 16 May 2015 10:32 PM |
Yeah, if you encounter any glitches or need help post them here :D gl
while true do the do |
|
|
| Report Abuse |
|
|
xLink123
|
  |
| Joined: 07 Aug 2014 |
| Total Posts: 11158 |
|
|
| 16 May 2015 10:34 PM |
Thank you, I am making a hunger games with some of my friends in my computer class and I'm in charge of coding it..
I will be sure to post here if I have troubles ty |
|
|
| Report Abuse |
|
|