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: Script stops at line 9?

Previous Thread :: Next Thread 
seanb117 is not online. 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 is not online. seanb117
Joined: 03 Feb 2010
Total Posts: 1020
01 Sep 2012 07:00 PM
bump
Report Abuse
ScrewDeath is not online. ScrewDeath
Joined: 03 Jun 2012
Total Posts: 2700
01 Sep 2012 07:02 PM
Maybe try....
:FindFirstChild()
Report Abuse
EndObesity is not online. EndObesity
Joined: 10 Aug 2012
Total Posts: 285
01 Sep 2012 07:03 PM
You forgot to submerge it in water, if 'ye know what I mean...hehehe. ;)


~End
Report Abuse
seanb117 is not online. 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
ScrewDeath is not online. ScrewDeath
Joined: 03 Jun 2012
Total Posts: 2700
01 Sep 2012 07:12 PM
What is the error you get in output?
Report Abuse
tahu157 is not online. 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
BobbyisLOLZ is not online. BobbyisLOLZ
Joined: 17 Aug 2010
Total Posts: 8045
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 is not online. 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 is not online. 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
BobbyisLOLZ is not online. BobbyisLOLZ
Joined: 17 Aug 2010
Total Posts: 8045
01 Sep 2012 07:22 PM
Also, it would be better to use :Destroy() instead of :remove() unless you are cloning them.
Report Abuse
BobbyisLOLZ is not online. BobbyisLOLZ
Joined: 17 Aug 2010
Total Posts: 8045
01 Sep 2012 07:23 PM
Well, I don't know then, because the script only needs 1 end. :\
Report Abuse
seanb117 is not online. 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
StealthKing95 is not online. StealthKing95
Joined: 13 Dec 2008
Total Posts: 4263
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 is not online. 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 is not online. seanb117
Joined: 03 Feb 2010
Total Posts: 1020
01 Sep 2012 07:43 PM
bump
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
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 is not online. 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 is not online. 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 is not online. seanb117
Joined: 03 Feb 2010
Total Posts: 1020
01 Sep 2012 08:26 PM
bump.. please help.
Report Abuse
Sharpshooter26 is not online. Sharpshooter26
Joined: 26 May 2010
Total Posts: 5166
01 Sep 2012 08:34 PM
BTR = game.Workspace:findFirstChild("BTR")

if BTR then

BTR:remove()
Report Abuse
Sharpshooter26 is not online. Sharpshooter26
Joined: 26 May 2010
Total Posts: 5166
01 Sep 2012 08:36 PM
wait

make it

local BTR = game.Workspace:findFirstChild("BTR")

Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
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
Sharpshooter26 is not online. Sharpshooter26
Joined: 26 May 2010
Total Posts: 5166
01 Sep 2012 08:42 PM
or be smart and use pcall qq
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
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
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