|
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|