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: Searching inside and inside a item consistantly

Previous Thread :: Next Thread 
1518NICENICKEY is not online. 1518NICENICKEY
Joined: 29 Apr 2009
Total Posts: 1136
31 Aug 2013 10:48 PM
num = 0
checked = 0
moss = nil
function Check(moss)
moss = moss
if moss ~= nil then
if moss.ClassName == "Fire" then
moss:Remove()
num = num + 1
end
all = moss:getChildren()
if #all ~= 0 then
all = moss:getChildren()
for a=1,#all do
Check(all[a])
end
end
checked = checked + 1
end
end
all = Workspace:getChildren()
for a=1,#all do
Check(all[a])
end
print("----------")
print(num.." found and removed")
print(checked.." looked inside but not infected")
print("----------")


It only replies that it found 3 when there is easily more then 400 bricks in the game.

I also need to know how to print the full location on where a object is.
Such as a tree

print(moss.Parent)
> Place1.game.Workspace.Model.Model.Model.Model.Part
Report Abuse
lampwnage121 is not online. lampwnage121
Joined: 20 Oct 2012
Total Posts: 4285
31 Aug 2013 10:53 PM
"I also need to know how to print the full location on where a object is."
Part:GetFullName()
To lazy to read the script
Report Abuse
Absurdism is not online. Absurdism
Joined: 18 Jul 2013
Total Posts: 2568
31 Aug 2013 10:58 PM
Regarding tree:

part = Workspace.Part
get = part
str = part.Name

while (not get:IsA('DataModel')) do
get = get.Parent
str = get.Name..'.'..str
end
str = 'Game.'..str
Report Abuse
Absurdism is not online. Absurdism
Joined: 18 Jul 2013
Total Posts: 2568
31 Aug 2013 10:58 PM
@lam
jesus christ when did such a method come out
you can't teach an old doge new tricks
Report Abuse
lampwnage121 is not online. lampwnage121
Joined: 20 Oct 2012
Total Posts: 4285
31 Aug 2013 11:03 PM
Didn`t bother reading your script
This script will Recurse the workspace and delete all fire/ take note how many there are

fire = 0
checked = 0

function Recurse(Part)
checked = checked + 1
if Part:IsA("Fire") then
Part:Destroy()
fire = fire + 1
end
Children = Part:GetChildren()
if #Children == 0 then return end
for _,v in pairs(Children) do
Recurse(v)
end
end
Recurse(game.Workspace)
safe = checked - fire
print("Fire: " .. fire .. " Checked: " .. checked .. " Not infected: " .. safe)
Report Abuse
Iterations is not online. Iterations
Joined: 22 Jul 2013
Total Posts: 751
31 Aug 2013 11:09 PM
function Clear(Parent, NameOrClassName)
local x = 0
local function Scan(parent)
for index, child in pairs(parent:GetChildren()) do
if child:IsA(NameOrClassName) or child.Name = NameOrClassName then
child:Destroy()
x = x + 1
end
Scan(child, NameOrClassName)
end
end
Scan(Parent)
return x
end

local Amount = Clear(Workspace, "Fire")
print(Amount.." found.")
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