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: how would you delete all parts

Previous Thread :: Next Thread 
ExtraTelamon is not online. ExtraTelamon
Joined: 26 Dec 2011
Total Posts: 4629
28 Aug 2013 09:16 AM
that have the same name
like for example
theres a bunch of parts named cheese in your place
and you want to get rid of them but they're inside a bunch of different models
Report Abuse
ExtraTelamon is not online. ExtraTelamon
Joined: 26 Dec 2011
Total Posts: 4629
28 Aug 2013 09:18 AM
?
Report Abuse
DaneelOlivaw is not online. DaneelOlivaw
Joined: 14 Apr 2012
Total Posts: 661
28 Aug 2013 09:21 AM
Hm. I was going to answer with "GetChildren()" but then I realized I don't know how to do unlimited recursive... things, whatever they're called, yet.

To ask ahead of time, would "cheese" be a name you as the placemaker set somehow, or would it just check for things that have copies? The former is easier, the latter may be drastically harder.
Report Abuse
getkoed is not online. getkoed
Joined: 18 Feb 2010
Total Posts: 2298
28 Aug 2013 09:24 AM
local n0bname = "cheese"

local function search(obj)
for _, v in pairs(obj:GetChildren()) do
if v.Name == n0bname then
v:Destroy()
else
search(v)
end
end
end

search(workspace)
Report Abuse
ExtraTelamon is not online. ExtraTelamon
Joined: 26 Dec 2011
Total Posts: 4629
28 Aug 2013 09:24 AM
well its kind of like this
i was gonna make a statue
so to get some ideas, i went to models and looked up some statues
and inside one of them had a vaccine
which inserts a "Fire" and a "Vaccine" script into every brick under workspace
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
28 Aug 2013 09:24 AM
function Delete(Location)
for Index, Child in pairs(Location:GetChildren()) do
if Child.Name == "Cheese" then
Child:Destroy()
end
Delete(Child)
end
end

Delete(Workspace)
Report Abuse
ExtraTelamon is not online. ExtraTelamon
Joined: 26 Dec 2011
Total Posts: 4629
28 Aug 2013 09:27 AM
knight
that last part looks funny
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
28 Aug 2013 09:28 AM
It's just the function's name.
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
28 Aug 2013 10:42 AM
Or we can just use

game.Workspace.Model:ClearAllParts()
Report Abuse
crazypeople203 is not online. crazypeople203
Joined: 09 Sep 2010
Total Posts: 289
28 Aug 2013 10:46 AM
for i, v in pairs(Workspace:GetChildren()) do
if v.Name == "Cheese" then
destroy()


I'm somewhat new, but I think that would work.

;n;
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
28 Aug 2013 10:48 AM
*ClearAllChildren()
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