|
| 12 Apr 2012 10:42 AM |
im making a thing that after 5 seconds it stops as a cover takes it. ok here the background of what im doing, im making a oil rig and i managed to make the thing drill for 20 seconds then shoot oil outa the top but how would i make the script stop after say 5 seconds? this is my script. and yes i have just edited a free model but thats what they are there for: print '1' wait(1) print '2' wait(1) print '3' wait(1) print '4' wait(1) print '5' wait(1) print '6' wait(1) print '7' wait(1) print '8' wait(1) print '9' wait(1) print '10' wait(1) print '11' wait(1) print '12' wait(1) print '13' wait(1) print '14' wait(1) print '15' wait(1) print '16' wait(1) print '17' wait(1) print '18' wait(1) print '19' wait(1) print '20' wait(1) print 'We struck OIL!!' local lifetime = 0.6
while true do wait(.1) local pos = script.Parent local b = Instance.new("Part")
b.Position = pos.Position + pos.CFrame.lookVector b.Size = Vector3.new(1, 1, 1) b.Shape = 0 b.BrickColor=BrickColor.new("Black") b.Transparency = 0.3 b.TopSurface = "Smooth" b.BottomSurface = "Smooth" b.CanCollide = true b.Parent = game.Workspace b.Velocity = Vector3.new(1, 75, 1) game:GetService("Debris"):AddItem(b, lifetime) end |
|
|
| Report Abuse |
|
|
|
| 12 Apr 2012 10:50 AM |
for a=1,20 do print(a) end print 'We struck OIL!!' local lifetime = 0.6 for a=.1,5,.1 do wait(.1) local pos = script.Parent local b = Instance.new("Part") b.Position = pos.Position + pos.CFrame.lookVector b.Size = Vector3.new(1, 1, 1) b.Shape = 0 b.BrickColor=BrickColor.new("Black") b.Transparency = 0.3 b.TopSurface = "Smooth" b.BottomSurface = "Smooth" b.CanCollide = true b.Parent = game.Workspace b.Velocity = Vector3.new(1, 75, 1) game:GetService("Debris"):AddItem(b, lifetime) end |
|
|
| Report Abuse |
|
|
|
| 12 Apr 2012 10:52 AM |
i dont want the balls to start shooting out until it says we struck oil
|
|
|
| Report Abuse |
|
|
|
| 12 Apr 2012 10:57 AM |
| I know that... Just play the script and see for yourelf big guy. |
|
|
| Report Abuse |
|
|
|
| 12 Apr 2012 11:00 AM |
and stops to easy it has to dig for 20 seconds then start producing the balls then stop after 5 seconds
|
|
|
| Report Abuse |
|
|
|
| 12 Apr 2012 11:01 AM |
| Dude, did you try the script? or are you just assuming that because it's so short compared to yours that it wont do what u want it to do? TRY IT and then tell me what is wrong with it. |
|
|
| Report Abuse |
|
|
|
| 12 Apr 2012 11:03 AM |
| ive tried it 2 times. i wouldnt judge a book by it cover expecially seems i cant script |
|
|
| Report Abuse |
|
|
| |
|
|
| 12 Apr 2012 11:05 AM |
| it counts to 20 instantly without even being in seconds and the balls are constantly spewing out after a few seconds they stop but it doesnt follow what i requestsed where my script would count to 20 seconds then start and i asked u to tell me how to make it stop |
|
|
| Report Abuse |
|
|
|
| 12 Apr 2012 11:06 AM |
I see the problem, I forgot to put a wait within the loop, sorry about that...
for a=1,20 do wait(1) print(a) end print 'We struck OIL!!' local lifetime = 0.6 for a=.1,5,.1 do wait(.1) local pos = script.Parent local b = Instance.new("Part") b.Position = pos.Position + pos.CFrame.lookVector b.Size = Vector3.new(1, 1, 1) b.Shape = 0 b.BrickColor=BrickColor.new("Black") b.Transparency = 0.3 b.TopSurface = "Smooth" b.BottomSurface = "Smooth" b.CanCollide = true b.Parent = game.Workspace b.Velocity = Vector3.new(1, 75, 1) game:GetService("Debris"):AddItem(b, lifetime) end |
|
|
| Report Abuse |
|
|
|
| 12 Apr 2012 11:09 AM |
| The way I made it stop was your script was a while true do loop, which never returns false and would never stop, so I simply made the loop into a for loop that integrated .1 until it equalled 5. Also, I changed the first part of your script so that instead of having many lines of waiting 1 second and then printing a new number, I just made another simple loop that waited 1 second each time and counted up to 20 integrating 1 each time. |
|
|
| Report Abuse |
|
|
|
| 12 Apr 2012 11:10 AM |
| thanks it works and no problem everyone makes mistakes |
|
|
| Report Abuse |
|
|