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 » Scripting Helpers
Home Search
 

Re: Help? On the countdown type script for surface gui

Previous Thread :: Next Thread 
HILLBILLYY is not online. HILLBILLYY
Joined: 08 May 2010
Total Posts: 764
21 Dec 2013 11:33 PM
WaitTime=0
script.Parent.spawn.MouseButton1Down:connect(function (Zombies)
if WaitTime<1 then
teamzombie:clone().Parent=game.Workspace
WaitTime=10
countdown()
end
end)

function countdown()
if WaitTime>1 then
for i=1,WaitTime do
WaitTime=WaitTime-1
script.Parent.wait.Text=WaitTime
end
end
end

Its not counting down it should when you click button spawn a zombie then return to 10 second wait before you can spawn another one. Any help?
Report Abuse
MXrcr20 is not online. MXrcr20
Joined: 01 Oct 2008
Total Posts: 2644
21 Dec 2013 11:58 PM
WaitTime = 10
script.Parent.spawn.MouseButton1Down:connect(function (Zombies)
countdown()
teamzombie:clone().Parent = game.Workspace
end)

function countdown()
for i = WaitTime, 0, -1 do
script.Parent.wait.Text = i
wait(1)
end
end
Report Abuse
MXrcr20 is not online. MXrcr20
Joined: 01 Oct 2008
Total Posts: 2644
22 Dec 2013 12:00 AM
If that doesn't work, just put the WaitTime between these lines like this. My mistake.

script.Parent.spawn.MouseButton1Down:connect(function (Zombies)
WaitTime = 10
countdown()
Report Abuse
Quorum is not online. Quorum
Joined: 25 Oct 2013
Total Posts: 4680
22 Dec 2013 12:00 AM
1) There's no need for a separate function, however for future reference you need to create the function before the point you attempt to call it otherwise it'll error, as it doesn't "exist yet".
2) Try the following (make sure you define what 'teamzombie' is)

local Deb = false
script.Parent.spawn.MouseButton1Down:connect(function()
if Deb then return end
Deb = true
teamzombie:clone().Parent=game.Workspace
for i = 10, 0, -1 do
wait(1)
script.Parent.wait.Text = i
end
Deb = false
end)
Report Abuse
HILLBILLYY is not online. HILLBILLYY
Joined: 08 May 2010
Total Posts: 764
23 Dec 2013 04:53 AM
Yep i figured it out all on my own this time :D see it in action at my zombie CTF Game
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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