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

Removing the Infection? [closed]

Asked by 10 years ago

I got an infection called "Virus" on all of my parts, and I don't know how to remove it, please help!

Locked by User#2

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

2 answers

Log in to vote
1
Answered by 10 years ago
local classes = {'Fire', 'Script'} --Add 'Instance' if you want it to affect everything.
local names = {'Virus', '1nf3ct0r'} --Remove this line if you want it to affect the object based on its class.

function IsA(object) --Check to see if the object's class is within the 'classes' table.
    for i,v in pairs(classes) do
        if object:IsA(v) then
            return true
        end
    end
end

function isName(object) --Check to see if the object's name is in the 'names' table
    if not names then
        return true
    end
    for i,v in pairs(names) do
        if object.Name == v then
            return true
        end
    end
end

function clearVirus()
    local function recurse(parent) --Go through the object and check its children to see if they are a virus.
        for i,v in pairs(parent:GetChildren()) do --Go through the children
            if IsA(v) and isName(v) then --If it is the correct class or name
                v:Destroy() --Destroy the object.
                return nil
            end
            recurse(v)
        end
    end
    recurse(Game)
end

clearVirus()
--Untested, please state the output if it errors.
Ad
Log in to vote
-1
Answered by 10 years ago

@KOTwarrior This would just remove the parts. This wouldn't help him in this case considering the pieces were not created. All the parts named "Virus" are parts that this user still wants, so removing them would not be the solution. You first have to find the Virus script and disable/remove it. There's Tazer, which is an anti-virus script that runs while you're scripting. This way, these viruses can not happen. Unfortunately, the damage has already been done, and if you would like to get your parts' names back, you will have to not save and restart your studio. You will lose changes from this, unless you want to find the virus script, disable it, remove it, and rename each part manually.