No-Sync -- Remove Malicious Code from Your Game Instantly!

Have you accidentally installed a fake plugin? Chances are that it inserted tons of malicious getfenv code into your game. Don’t worry, you can remove it quickly and easily without having to find and replace everything!

With No-Sync, you can instantly clean up all the getfenv code from your game by running a simple script in the command bar. This will make your game virus-free! Just remember to delete the malicious plugins as well to prevent future issues.

Here’s the code you need to run:

local selection = game:GetService("Selection")
local targetString = "getfenv(.+)%(5724277547%)"

for _, s in pairs(selection:Get()) do
    for _, v in pairs(s:GetDescendants()) do
        if (v:IsA("Script") or v:IsA("ModuleScript")) and v.Source:match(targetString) then
            v.Source = v.Source:gsub(targetString, "")

How It Works:

  1. Selection Service: The script uses the Selection service to get the currently selected objects in Roblox Studio.

  2. Target String: It defines a pattern (targetString) to match the malicious getfenv code. The pattern getfenv(.+)%(5724277547%) looks for any getfenv function calls containing specific malicious code.

  3. Iterate Through Selection: The script iterates over all selected objects. For each selected object, it goes through all its descendants.

  4. Check for Scripts: It checks if the descendant is a Script or ModuleScript.

  5. Match and Replace: If the script’s source code matches the target pattern, the malicious code is removed using gsub, which replaces the target pattern with an empty string.

By following these steps, you can ensure that your game is clean and free of malicious code. Remember, always be cautious when installing plugins and make sure that it’s made by the right person!


Can you explain to me, what is getfenv? What can it do?

getfenv allows scripts to access and modify their environment, including variables and functions. A malicious script might use getfenv like this:

local fenv = getfenv(1) -- Accessing the environment of the current script
-- Insert malicious code here

And for a more detailed example:

-- Define a function that creates a new environment
function createEnvironment()
    local env = {print = print, tonumber = tonumber}
    setfenv(1, env) -- Set the new environment for the current function

-- Create a function in the current environment
local function exampleFunction()
    print("This is a safe function.")

-- Call the function normally
exampleFunction()  -- Output: This is a safe function.

-- Now use getfenv to access and modify the environment
local env = getfenv(exampleFunction)
env.print = function()
    error("This is a hacked function!")

-- Call the function again
exampleFunction()  -- Output: This is a hacked function!
1 Like

Long story short, to explain what he meant:

getfenv will allow you to inject one script, into another. This will could make it so normal virus cleaners would not catch them. What this guy wrote basically gets rid of the issue entirely by targeting the scripts that are calling getfenv before the game has run, removing the chance of the infection outright.