✓ Accepted answer
I don't know what a "Fire spread script" is, but I've seen things that sound similar.
Try using this script instead, it should work to remove all the spammed objects, but it's untested.
function clean(name, path, otype)
for i,v in pairs(path:GetChildren()) do
if v:IsA(otype) == true and v.Name == name then
if v:GetChildren() ~= nil then
clean(name, v, otype)
end
v:Destroy()
end
end
end
Now you just call the function with whatever parameters you want, because I don't know what the fire spread script is.
Side note: If your "developers" use free models, fire them.
EDIT: If you're asking how to complete that script, you can use the :Destroy() method to destroy the objects, or the :remove() method if you want to set their parent to nil.
6 comments
The script didn't work, but I managed to complete my own. Thanks anyways! am gonna give you the script if the same happens to you! PS: Spread fire scripts are scripts that spread fire in your game for the hopes of making it laggier.
local descendants = game.Workspace:GetDescendants() local amount = 0 for index, descendant in pairs(descendants) do if descendant.Name == "Fire" or descendant.Name == "Smoke" then descendant:Destroy() amount = amount + 1 if amount >= 620 then print(amount.." viruses removed, omg") end end end
No, do not promote deprecated code. :remove() is deprecated.
Well, to be fair I used :Destroy() in my code, I just said :remove() is another method that sets the parent to nil.
No, deprecated code is never the way to go. You can simply set it to nil by manually assigning the parent to nil. obj.Parent = nil
And :Destroy() is different than :remove(), all :remove() does is set the parent to nil whilst :Destroy() does that, disconnects all connections, and LOCKS the parent property, and prepares the object for garbage collection.