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 I remove all objects of a specific class?

Previous Thread :: Next Thread 
Kyuro is not online. Kyuro
Joined: 03 Sep 2012
Total Posts: 5800
07 May 2014 07:23 AM
e.g. Remove a character of all of its hats?
Report Abuse
RoflBread is not online. RoflBread
Joined: 18 Jun 2009
Total Posts: 3803
07 May 2014 07:36 AM
for _,v in pairs(model)
if v:IsA("Hat") then
v:Destroy()
end
end
Report Abuse
Kyuro is not online. Kyuro
Joined: 03 Sep 2012
Total Posts: 5800
13 May 2014 09:09 PM
Um, I don't exactly understand..
Report Abuse
Vuva is not online. Vuva
Joined: 22 Jan 2010
Total Posts: 1102
13 May 2014 09:50 PM
It lopos through all of the children of "model", and destroys each child that is a "Hat"

for _,v in pairs(model) --A generic for loop, looping through the children of the object "model"(You would                                            have to change that")
if v:IsA("Hat") then        --If the ClassName of the current child == "Hat"
v:Destroy()                     --Destroy the current child
end
end
Report Abuse
Kyuro is not online. Kyuro
Joined: 03 Sep 2012
Total Posts: 5800
14 May 2014 07:22 AM
TY for the further explanation, I understand now :D
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