Need help removing a virus from all of my scripts at once

I was messing around with plugins and then realized that they inserted multiple requires into scripts, and I was wondering what would be a quick way to remove them from all of these scripts?

1 Like

You can use CTRL+SHIFT+F and input ‘require(3453535454)’ along with that it has a replace all feature so you can simply replace it with nothing

1 Like

heres the thing; nearly 10000 scripts are infected, and doing this is extremally inefficient, so i was wondering if I could script a plugin to make it go a little faster

do you know about the command bar? You can type codes in there like its a script and it will run like a script too

but can i edit scripts via it?

yes, using SourceContainer.Source, SourceContainer is a script,local script, or a module.
I can give you code if you dont know how

ok right now i have

if tostring(game.Workspace.Script.Source):find("require(3434344343443)") then 
	game.Workspace.Script.Source:gsub("require(3434344343443)", "")

but it doesnt work

many people make this mistake. gsub does not change the value directly, instead it returns the changed string. So what you did is, game.Workspace.Script.Source take the string “code blah blah”, then gsub it, then it returns the gsub-ed string, but it did not change the Source yet.

What you should do instead is this
Script.Source = Script.Source:gsub("require(3434344343443)", "")

But since you said there are thousands of script affected, this is ineffecient

Edit: just tested this, apparently “(” and “)” are magic characters and is detected by the string patterns. You need to add “%” signs before those characters
Script.Source = Script.Source:gsub("require%(3434344343443%)", "")


This is janky because you’re gonna be running it in the command line but you need to escape the parentheses because they’re special characters or whatever, this’ll work but might freeze studio because you’ve 10000 scripts (sorry didn’t see your script lielmaster):

for i,v in ipairs(game:GetDescendants()) do
        v.Source = v.Source:gsub('require%(3453535454%)', '')

This will error since some game Descendants cannot be accessed. This is the right way
I dont understand why, did it not work when i tested it before.

Just use @7z99’s method.

It won’t error, you need to wrap anything in a pcall before indexing it so it doesn’t error.

no, i mean even without the pcall. Before, doing this will throw an error

for i, v in pairs(game:GetDescendants()) do end

It won’t error, you can run game:GetDescendants, you just can’t index any of the instances without an error which is why you need to wrap it in a pcall.


You mean you can’t have a reference of it, like game.blah.blahblah?

No, you can’t index it assuming it’s a descendant of CoreGui. You can’t access any of their properties or functions without an error.

this runs fine

for i, v in pairs(game:GetDescendants()) do
	local x = v.Name

what if it had .load() at the end, would it be .load%(%)?

yes, anyways you can use @7z99’s method or this. Any would work

local services = {"Workspace","Players","Lighting","MaterialService","ReplicatedFirst","ReplicatedStorage","ServerScriptService","ServerStorage","StarterGui","StarterPack","StarterPlayer","Teams","SoundService","Chat"}
for _, v in pairs(services) do
	for _, script:Instance in pairs(game[v]:GetDescendants()) do
		if script:IsA("LuaSourceContainer") then script.Source = script.Source:gsub("require%3434344343443%)", "") end

oh great im figuring out it has require(345353)), how would i go about remove the ))

you just a % for each magic character