|
| 12 Aug 2012 09:08 AM |
I need help of writing a script...
for example; Like a countdown till zombies attack, when it reaches 0 zombies appear, and when the countdown untill zombie attack ends, when it reaches 0 they go.
I have a good idea for my place and would love to know how to script this. |
|
|
| Report Abuse |
|
|
1Topcop
|
  |
| Joined: 09 Jun 2009 |
| Total Posts: 6635 |
|
|
| 12 Aug 2012 09:12 AM |
Use a for loop.
for Seconds=60,1,-1 do print(Seconds.." seconds remaining...") wait(1) end |
|
|
| Report Abuse |
|
|
URX
|
  |
| Joined: 10 Nov 2009 |
| Total Posts: 1054 |
|
|
| 12 Aug 2012 10:18 AM |
Plus to add onto that: for Seconds=60,1,-1 do print(Seconds.." seconds remaining...") game.Lighting.ZOMBIES_NAME_HERE:Clone().Parent = game.Workspace wait(0.1) local p = Instance.new("Hint",game.Workspace) p.Name="Zombieshere" p.text="Zombies are attacking!" wait(30) game.Workspace.Zombieshere:Destroy()
end
|
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 12 Aug 2012 11:51 AM |
for Seconds=60,1,-1 do print(Seconds.." seconds remaining...") game.Lighting.ZOMBIES_NAME_HERE:Clone().Parent = game.Workspace wait(0.1) local p = Instance.new("Hint",game.Workspace) p.Name="Zombieshere" p.text="Zombies are attacking!" wait(30) game.Workspace.Zombieshere:Destroy()
end
^You have to modify the script for it to work and put in the name of your Zombie Model. So change the ZOMBIES_NAME_HERE and Zombieshere
Also, put the zombies in game.Lighting or it won't work.
If it doesn't work, idk xD |
|
|
| Report Abuse |
|
|
|
| 12 Aug 2012 11:54 AM |
--For this you will need a complete model called Zombies stored inside Lighting, which is self-explanatory what it needs.
--SCRIPT BEGIN
while true do --Start the infinite loop local h = Instance.new("Hint", Workspace) --Spawn a hint h.Text = "Uh-oh! Zombies are coming!" --Make the hint say that wait(4) --wait 4 seconds for seconds = 30, 0, -1 do --Do it where the Seconds variable counts down from 30 h.Text = ("Time until zombies appear: "..seconds) --The text says how much time is left wait(1) --Wait 1 second between loops end --End the for loop h.Text = "THE ZOMBIES ARE HERE! ZOMG" --Make the text say that local z = game.Lighting.Zombies:Clone() --Clone the zombies z.Parent = game.Workspace --Put them into Workspace wait(30) --Wait 30 seconds z:Destroy() --Get rid of the zombies h.Text = "Phew, the zombies are gone!" --Make the text say that wait(10) --Wait 10 seconds h:Destroy() --Get rid of the hint (considering it will spawn again right away) end --End the infinite loop |
|
|
| Report Abuse |
|
|
URX
|
  |
| Joined: 10 Nov 2009 |
| Total Posts: 1054 |
|
|
| 12 Aug 2012 11:56 AM |
| Why did you change the Clone to a local? |
|
|
| Report Abuse |
|
|
|
| 12 Aug 2012 12:00 PM |
Bcuz local runs faster :p
~This sig is false~ |
|
|
| Report Abuse |
|
|