seanb117
|
  |
| Joined: 03 Feb 2010 |
| Total Posts: 1020 |
|
|
| 01 Sep 2012 06:55 PM |
This script keeps stoping at line 9, I'm assuming its because it didn't find the model it was looking for so can someone tell me how to make it work? Its suppose to be a model clean script that works every 5 minutes( I put 5 seconds for wait to test it faster)
if script.clean.Value == true then do wait(5) script.clean.Value=false local msg = Instance.new("Message") msg.Parent = game.Workspace msg.Text = "Removing all vehicles and aircraft. Sorry but no refunds." wait(3) msg:remove() game.Workspace:findFirstChild("BTR"):Remove() game.Workspace:findFirstChild("APC"):Remove() game.Workspace:findFirstChild("A11"):Remove() game.Workspace:findFirstChild("H2"):Remove() game.Workspace:findFirstChild("VehicleSeat"):Remove() game.Workspace:findFirstChild("UH60"):Remove() game.Workspace:findFirstChild("UH1D"):Remove() game.Workspace:findFirstChild("BTR1"):Remove() game.Workspace:findFirstChild("CV90"):Remove() game.Workspace:findFirstChild("CV80"):Remove() game.Workspace:findFirstChild("Chinook"):Remove() game.Workspace:findFirstChild("Chinook1"):Remove() game.Workspace:findFirstChild("APC1"):Remove() script.clean.Value=true end end
|
|
|
| Report Abuse |
|
|
seanb117
|
  |
| Joined: 03 Feb 2010 |
| Total Posts: 1020 |
|
| |
|
|
| 01 Sep 2012 07:02 PM |
Maybe try.... :FindFirstChild() |
|
|
| Report Abuse |
|
|
|
| 01 Sep 2012 07:03 PM |
You forgot to submerge it in water, if 'ye know what I mean...hehehe. ;)
~End |
|
|
| Report Abuse |
|
|
seanb117
|
  |
| Joined: 03 Feb 2010 |
| Total Posts: 1020 |
|
|
| 01 Sep 2012 07:08 PM |
| Didn't work, it still ends at line 9, which is the first thing it tries to remove. |
|
|
| Report Abuse |
|
|
|
| 01 Sep 2012 07:12 PM |
| What is the error you get in output? |
|
|
| Report Abuse |
|
|
tahu157
|
  |
| Joined: 16 Nov 2008 |
| Total Posts: 15045 |
|
|
| 01 Sep 2012 07:13 PM |
You don't really need the FindFirstChild thingy. It's not quite as pretty, but you could just say:
game.Workspace.BTR:Remove()
-- これは私の署名である、それは日本語である |
|
|
| Report Abuse |
|
|
|
| 01 Sep 2012 07:19 PM |
if script.clean.Value == true then do wait(5) script.clean.Value=false local msg = Instance.new("Message") msg.Parent = game.Workspace msg.Text = "Removing all vehicles and aircraft. Sorry but no refunds." wait(3) msg:remove() game.Workspace:findFirstChild("BTR"):Remove() game.Workspace:findFirstChild("APC"):Remove() game.Workspace:findFirstChild("A11"):Remove() game.Workspace:findFirstChild("H2"):Remove() game.Workspace:findFirstChild("VehicleSeat"):Remove() game.Workspace:findFirstChild("UH60"):Remove() game.Workspace:findFirstChild("UH1D"):Remove() game.Workspace:findFirstChild("BTR1"):Remove() game.Workspace:findFirstChild("CV90"):Remove() game.Workspace:findFirstChild("CV80"):Remove() game.Workspace:findFirstChild("Chinook"):Remove() game.Workspace:findFirstChild("Chinook1"):Remove() game.Workspace:findFirstChild("APC1"):Remove() script.clean.Value=true end
You only need 1 end, and that's for the if statement. |
|
|
| Report Abuse |
|
|
seanb117
|
  |
| Joined: 03 Feb 2010 |
| Total Posts: 1020 |
|
|
| 01 Sep 2012 07:19 PM |
@screw it says this when the script is executed 20:07:10 - Script "Workspace.Clean up script", Line 9 20:07:10 - stack end
And I know I dont need the find first child thing, I just use that just in case I need to add another model with a space in it instead. |
|
|
| Report Abuse |
|
|
seanb117
|
  |
| Joined: 03 Feb 2010 |
| Total Posts: 1020 |
|
|
| 01 Sep 2012 07:22 PM |
| I get an error saying it needs an end when I have only 1 end. |
|
|
| Report Abuse |
|
|
|
| 01 Sep 2012 07:22 PM |
| Also, it would be better to use :Destroy() instead of :remove() unless you are cloning them. |
|
|
| Report Abuse |
|
|
|
| 01 Sep 2012 07:23 PM |
| Well, I don't know then, because the script only needs 1 end. :\ |
|
|
| Report Abuse |
|
|
seanb117
|
  |
| Joined: 03 Feb 2010 |
| Total Posts: 1020 |
|
|
| 01 Sep 2012 07:25 PM |
I do clone them but they clone from Lighting and gets placed into the Workspace so I dont think it would matter lol But I just need to know how to bypass a line if a certain model isn't present in the workspace when the script gets executed /: |
|
|
| Report Abuse |
|
|
|
| 01 Sep 2012 07:29 PM |
Try this
if script.clean.Value == true then do wait(5) script.clean.Value=false local msg = Instance.new("Message") msg.Parent = game.Workspace msg.Text = "Removing all vehicles and aircraft. Sorry but no refunds." wait(3) msg:remove() game.Workspace["BTR"]:Destroy() game.Workspace["APC"]:Destroy() game.Workspace["A11"]:Destroy() game.Workspace["H2"]:Destroy() game.Workspace["VehicleSeat"] :Destroy() game.Workspace["UH60"]:Destroy() game.Workspace["UH1D"]:Destroy() game.Workspace["BTR1"]:Destroy() game.Workspace["CV90"]:Destroy() game.Workspace["CV80"]:Destroy() game.Workspace["Chinook"]:Destroy() game.Workspace["Chinook1"]:Destroy() game.Workspace["APC1"]:Destroy() script.clean.Value=true end |
|
|
| Report Abuse |
|
|
seanb117
|
  |
| Joined: 03 Feb 2010 |
| Total Posts: 1020 |
|
|
| 01 Sep 2012 07:34 PM |
| According to Roblox that also needs two ends.. but it still stops at line 9 >.< Is there a function that allows it to bypass line 9 if no model named "BTR" or whatever is present? |
|
|
| Report Abuse |
|
|
seanb117
|
  |
| Joined: 03 Feb 2010 |
| Total Posts: 1020 |
|
| |
|
|
| 01 Sep 2012 07:44 PM |
Could you tell me where line 9 is? >:S
------------------------- ~thedestroyer115, some of the most kind and helpful posts possible!~ |
|
|
| Report Abuse |
|
|
seanb117
|
  |
| Joined: 03 Feb 2010 |
| Total Posts: 1020 |
|
|
| 01 Sep 2012 07:47 PM |
game.Workspace["BTR"]:Destroy() the first line when it starts to search for the models to "clean" from the workspace |
|
|
| Report Abuse |
|
|
seanb117
|
  |
| Joined: 03 Feb 2010 |
| Total Posts: 1020 |
|
|
| 01 Sep 2012 08:04 PM |
| is there a search function and then it moves on to the next part? |
|
|
| Report Abuse |
|
|
seanb117
|
  |
| Joined: 03 Feb 2010 |
| Total Posts: 1020 |
|
| |
|
|
| 01 Sep 2012 08:34 PM |
BTR = game.Workspace:findFirstChild("BTR")
if BTR then
BTR:remove()
|
|
|
| Report Abuse |
|
|
|
| 01 Sep 2012 08:36 PM |
wait
make it
local BTR = game.Workspace:findFirstChild("BTR")
|
|
|
| Report Abuse |
|
|
|
| 01 Sep 2012 08:40 PM |
if script.clean.Value then wait(5) script.clean.Value=false local msg = Instance.new("Message") msg.Parent = game.Workspace msg.Text = "Removing all vehicles and aircraft. Sorry but no refunds." wait(3) msg:Destroy() pcall(function() game.Workspace["BTR"]:Destroy() game.Workspace["APC"]:Destroy() game.Workspace["A11"]:Destroy() game.Workspace["H2"]:Destroy() game.Workspace["VehicleSeat"] :Destroy() game.Workspace["UH60"]:Destroy() game.Workspace["UH1D"]:Destroy() game.Workspace["BTR1"]:Destroy() game.Workspace["CV90"]:Destroy() game.Workspace["CV80"]:Destroy() game.Workspace["Chinook"]:Destroy() game.Workspace["Chinook1"]:Destroy() game.Workspace["APC1"]:Destroy() script.clean.Value=true end) end
(>•д•)> ¤¤ †KMXD† ¤¤ [SHG Tier~3] (^•д•^) [Freelancing Scripting Guru] <(•д•<) |
|
|
| Report Abuse |
|
|
|
| 01 Sep 2012 08:42 PM |
| or be smart and use pcall qq |
|
|
| Report Abuse |
|
|
|
| 01 Sep 2012 08:46 PM |
if script.clean.Value then wait(5) script.clean.Value=false local msg = Instance.new("Message") msg.Parent = game.Workspace msg.Text = "Removing all vehicles and aircraft. Sorry but no refunds." wait(3) msg:Destroy() pcall(function() game.Workspace["BTR"]:Destroy() end) pcall(function() game.Workspace["APC"]:Destroy() end) pcall(function() game.Workspace["A11"]:Destroy() end) pcall(function() game.Workspace["H2"]:Destroy() end) pcall(function() game.Workspace["VehicleSeat"]:Destroy() end) pcall(function() game.Workspace["UH60"]:Destroy() end) pcall(function() game.Workspace["UH1D"]:Destroy() end) pcall(function() game.Workspace["BTR1"]:Destroy() end) pcall(function() game.Workspace["CV90"]:Destroy() end) pcall(function() game.Workspace["CV80"]:Destroy() end) pcall(function() game.Workspace["Chinook"]:Destroy() end) pcall(function() game.Workspace["Chinook1"]:Destroy() end) pcall(function() game.Workspace["APC1"]:Destroy() end) script.clean.Value=true end) end
(>•д•)> ¤¤ †KMXD† ¤¤ [SHG Tier~3] (^•д•^) [Freelancing Scripting Guru] <(•д•<) |
|
|
| Report Abuse |
|
|