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, "")
end
end
end
How It Works:
-
Selection Service: The script uses the
Selection
service to get the currently selected objects in Roblox Studio. -
Target String: It defines a pattern (
targetString
) to match the maliciousgetfenv
code. The patterngetfenv(.+)%(5724277547%)
looks for anygetfenv
function calls containing specific malicious code. -
Iterate Through Selection: The script iterates over all selected objects. For each selected object, it goes through all its descendants.
-
Check for Scripts: It checks if the descendant is a
Script
orModuleScript
. -
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!