Vorsel
|
  |
| Joined: 09 Apr 2012 |
| Total Posts: 744 |
|
|
| 26 Mar 2017 04:20 PM |
| I have a main script for an upcoming minigame server. The countdown, the spawning, intermission all work fine. My only issue is when there is a winner, the game still counts down to zero. Any issue to fix this? Here is the script: ######################################################## |
|
|
| Report Abuse |
|
|
Vorsel
|
  |
| Joined: 09 Apr 2012 |
| Total Posts: 744 |
|
|
| 26 Mar 2017 04:20 PM |
| ############################### |
|
|
| Report Abuse |
|
|
Vorsel
|
  |
| Joined: 09 Apr 2012 |
| Total Posts: 744 |
|
| |
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 26 Mar 2017 04:23 PM |
winner = nil countdown = 60
WinConditionEvent:connect(function(whoWon) winner = whoWon end)
while not winner and wait(1) do countdown = countdown-1 print(countdown) end
-- stop the game here
|
|
|
| Report Abuse |
|
|
Vorsel
|
  |
| Joined: 09 Apr 2012 |
| Total Posts: 744 |
|
|
| 26 Mar 2017 04:43 PM |
| I hope this works, but before I do, where would I put it? Also, I've never heard of a WinConditionEvent. Do I need to define it somewhere? ################################################## |
|
|
| Report Abuse |
|
|
Vorsel
|
  |
| Joined: 09 Apr 2012 |
| Total Posts: 744 |
|
|
| 26 Mar 2017 04:44 PM |
| ######################################################## |
|
|
| Report Abuse |
|
|
Vorsel
|
  |
| Joined: 09 Apr 2012 |
| Total Posts: 744 |
|
|
| 26 Mar 2017 04:45 PM |
| I thought we could post ####### links. why did ROBLOX add this chat censor. |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 26 Mar 2017 04:45 PM |
Yeah you need to define it, this is conceptual code, don't just copy paste. This polls until there is a winner, then stops the countdown.
The literal solution will be very specific to your current setup.
|
|
|
| Report Abuse |
|
|
Vorsel
|
  |
| Joined: 09 Apr 2012 |
| Total Posts: 744 |
|
|
| 26 Mar 2017 04:55 PM |
| My question is what is WinConditionEvent? What do I define it as. Here is the code after the countdown when it says Begin: ChangeText('Begin!') for i = GameTime, ## ## ## ############# ..i) -- Minigame Timer wait(1) end local Players = game.Players:GetPlayers() for i = 1, #Players do if Players[i].Playing.Value == true then table.insert(Winners, Players[i].Name) Players[i].leaderstats.Points.Value = Players[i].leaderstats.Points.Value + 5 Players[i].leaderstats.Wins.Value = Players[i].leaderstats.Wins.Value + 1 Players[i].Character.Humanoid.Health = 0 Players[i].Playing.Value = false Players[i].PlayerGui.Main.PointShower.TextLabel.Visible = true end end RemoveMap() ChangeText('Game Over!') wait(4) end |
|
|
| Report Abuse |
|
|