Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

I need help with a script?

Asked by 9 years ago

I'm sorry I know this site isn't for request but I have no idea how to even start this script other than using while wait(0.1) do anyways... I need a script that will go into every single child in the workspace and if the child has more children then go into those also and delete an item from them like OH SNAP YOU GOT INFECTED XD XD XD from the children in the workspace would anyone mind helping me out yes I know again this site isn't for request but i'm desperate....

1 answer

Log in to vote
0
Answered by 9 years ago

You could use a recursive function.

local remove = {} 

local function shouldRemove(name)
    for i2, v2 in next, remove do
        if tostring(i2):lower() == name:lower() or tostring(v2):lower() == name:lower() then
            return true
        end
    end
    return false
end

local function scan(v)
    for i,v in next, v:GetChildren() do
        if shouldRemove(v.Name) then
            v:Destroy()
        end
        scan(v)
    end
end

scan(Workspace)

Make sure you put the names of things you want removed in the remove table on line 1.

0
Thank you so much it worked :D I made roblox anti-virus :D xXV3rmillionXx 0 — 9y
Ad

Answer this question