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: detecting how many of an object are in workspace?

Previous Thread :: Next Thread 
callmeduck2 is not online. callmeduck2
Joined: 18 Jan 2010
Total Posts: 2804
28 Sep 2011 07:19 PM
for i, v in pairs(game.Workspace:GetChildren()) do
if (v.Enemy ~= nil) then
v.Enemy:Remove()

would this remove everything (not in a model) in workspace named 'Enemy'?

sorry about so many topics lol. this should be the last.
Report Abuse
BCGames is not online. BCGames
Joined: 30 Dec 2010
Total Posts: 8182
28 Sep 2011 07:21 PM
Kill = "Enemy"

function findKill(obj)
for _,v in pairs(obj:GetChildren()) do
if v.Name == Kill then
v:remove()
elseif v.Name ~= Kill then
findKill(v)
end
end

findKill(workspace)
Report Abuse
1Ra is not online. 1Ra
Joined: 02 May 2010
Total Posts: 2400
28 Sep 2011 07:21 PM
if you added 2 ends, then yes
Report Abuse
PompeyTheGreat is not online. PompeyTheGreat
Joined: 10 Apr 2011
Total Posts: 5615
28 Sep 2011 07:21 PM
This would not work without ends, but it should remove anything in workspace that has a child named "Enemy."
Report Abuse
callmeduck2 is not online. callmeduck2
Joined: 18 Jan 2010
Total Posts: 2804
28 Sep 2011 07:25 PM
oh yea i forgot about the ends..
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