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 » Scripters
Home Search
 

Game Ends When There is a Winner?

Previous Thread :: Next Thread 
Vorsel is not online. 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 is not online. Vorsel
Joined: 09 Apr 2012
Total Posts: 744
26 Mar 2017 04:20 PM
###############################
Report Abuse
Vorsel is not online. Vorsel
Joined: 09 Apr 2012
Total Posts: 744
26 Mar 2017 04:20 PM
why do this roblox?
Report Abuse
Soybeen is not online. 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 is not online. 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 is not online. Vorsel
Joined: 09 Apr 2012
Total Posts: 744
26 Mar 2017 04:44 PM
########################################################
Report Abuse
Vorsel is not online. 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 is not online. 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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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