harbar565
|
  |
| Joined: 05 Nov 2010 |
| Total Posts: 67 |
|
|
| 29 Jan 2012 10:16 PM |
local Alive = {} local GameActive = false
function PlayerDied(Player) if Alive[Player.Name] then Alive[Player.Name] = false end end
function SetPlayersAlive() for _, v in pairs(game.Players:GetPlayers()) do if v.Character and v.Character:FindFirstChild("Humanoid") and not GameActive then Alive[v.Name] = true v.Character.Humanoid.Died:connect(function() PlayerDied(v) end) end end end
function AllPlayersDead() for _, v in pairs(Alive) do if v then return false end end return true end
game.Players.PlayerRemoving:connect(function(player) PlayerDied(player) end) while true do wait(2) msg = Instance.new("Hint") msg.Parent = game.Workspace msg.Text = "Game Starting In 30" wait(1) msg.Text = "Game Starting In 29" wait(1) msg.Text = "Game Starting In 28" wait(1) msg.Text = "Game Starting In 27" wait(1) msg.Text = "Game Starting In 26" wait(1) msg.Text = "Game Starting In 25" wait(1) msg.Text = "Game Starting In 24" wait(1) msg.Text = "Game Starting In 23" wait(1) msg.Text = "Game Starting In 22" wait(1) msg.Text = "Game Starting In 21" wait(1) msg.Text = "Game Starting In 20" wait(1) msg.Text = "Game Starting In 19" wait(1) msg.Text = "Game Starting In 18" wait(1) msg.Text = "Game Starting In 17" wait(1) msg.Text = "Game Starting In 16" wait(1) msg.Text = "Game Starting In 15" wait(1) msg.Text = "Game Starting In 14" wait(1) msg.Text = "Game Starting In 13" wait(1) msg.Text = "Game Starting In 12" wait(1) msg.Text = "Game Starting In 11" wait(1) msg.Text = "Game Starting In 10" wait(1) msg.Text = "Game Starting In 9" wait(1) msg.Text = "Game Starting In 8" wait(1) msg.Text = "Game Starting In 7" wait(1) msg.Text = "Game Starting In 6" wait(1) msg.Text = "Game Starting In 5" wait(1) msg.Text = "Game Starting In 4" wait(1) msg.Text = "Game Starting In 3" wait(1) msg.Text = "Game Starting In 2" wait(1) msg.Text = "Game Starting In 1" wait(1) msg.Text = "Teleporting" target = CFrame.new(56.5, 97.6, -186.5) for i, player in ipairs(game.Players:GetChildren()) do player.Character.Torso.CFrame = target + Vector3.new(0, i * 5, 0) end wait(2) msg:remove() SetPlayersAlive() repeat wait() until AllPlayersDead() wait(50) end
What is wrong with this script? Ignore all the "Messages" I need to know what is wrong with the function or if i need to move it. I want the script to end and start over when ALL the players are dead. Is there a way to do that? |
|
|
| Report Abuse |
|
|
harbar565
|
  |
| Joined: 05 Nov 2010 |
| Total Posts: 67 |
|
| |
|
harbar565
|
  |
| Joined: 05 Nov 2010 |
| Total Posts: 67 |
|
| |
|
|
| 29 Jan 2012 10:30 PM |
while true do wait(2) msg = Instance.new("Hint") msg.Parent = game.Workspace
--[[ I'm also changing this msg.Text = "Game Starting In 30" wait(1) msg.Text = "Game Starting In 29" wait(1) msg.Text = "Game Starting In 28" wait(1) msg.Text = "Game Starting In 27" wait(1) msg.Text = "Game Starting In 26" wait(1) msg.Text = "Game Starting In 25" wait(1) msg.Text = "Game Starting In 24" wait(1) msg.Text = "Game Starting In 23" wait(1) msg.Text = "Game Starting In 22" wait(1) msg.Text = "Game Starting In 21" wait(1) msg.Text = "Game Starting In 20" wait(1) msg.Text = "Game Starting In 19" wait(1) msg.Text = "Game Starting In 18" wait(1) msg.Text = "Game Starting In 17" wait(1) msg.Text = "Game Starting In 16" wait(1) msg.Text = "Game Starting In 15" wait(1) msg.Text = "Game Starting In 14" wait(1) msg.Text = "Game Starting In 13" wait(1) msg.Text = "Game Starting In 12" wait(1) msg.Text = "Game Starting In 11" wait(1) msg.Text = "Game Starting In 10" wait(1) msg.Text = "Game Starting In 9" wait(1) msg.Text = "Game Starting In 8" wait(1) msg.Text = "Game Starting In 7" wait(1) msg.Text = "Game Starting In 6" wait(1) msg.Text = "Game Starting In 5" wait(1) msg.Text = "Game Starting In 4" wait(1) msg.Text = "Game Starting In 3" wait(1) msg.Text = "Game Starting In 2" wait(1) msg.Text = "Game Starting In 1" wait(1) ]]
for i = 30, 1, -1 do msg.Text = "Game Starting In "..i wait(1) end
msg.Text = "Teleporting" target = CFrame.new(56.5, 97.6, -186.5) for i, player in ipairs(game.Players:GetChildren()) do player.Character.Torso.CFrame = target + Vector3.new(0, i * 5, 0) end SetPlayersAlive() GameActive = true wait(2) --Moved a few things around down here, and added the GameActive parts msg:remove() repeat wait() until AllPlayersDead() GameActive = false wait(5) -- intermission time end |
|
|
| Report Abuse |
|
|
harbar565
|
  |
| Joined: 05 Nov 2010 |
| Total Posts: 67 |
|
|
| 29 Jan 2012 10:33 PM |
| ty i will see if this works right now :D |
|
|
| Report Abuse |
|
|
harbar565
|
  |
| Joined: 05 Nov 2010 |
| Total Posts: 67 |
|
|
| 29 Jan 2012 10:35 PM |
| omg it works :DDD!! I can still add to the while true loop right? |
|
|
| Report Abuse |
|
|
harbar565
|
  |
| Joined: 05 Nov 2010 |
| Total Posts: 67 |
|
|
| 29 Jan 2012 10:37 PM |
would i add things on after the
repeat wait() until AllPlayersDead()
??? |
|
|
| Report Abuse |
|
|
harbar565
|
  |
| Joined: 05 Nov 2010 |
| Total Posts: 67 |
|
|
| 29 Jan 2012 10:44 PM |
| ok figured it all out.. thank you ! |
|
|
| Report Abuse |
|
|