Is there any way to prevent those require(assetid) MainModule script exploits? Currently running into a issue with them and don’t know the proper way to patch them. This is my script on how I currently do them. Is there anything I can do to improve? Because right now all I do if figure out the model it spawns and then just destroy it from the game.
--> Services
local Players = game:GetService("Players")
workspace.ChildAdded:Connect(function(object)
if object.Name == "a" then
for _, children in object:GetChildren() do
children:Destroy()
end
object:Destroy()
end
end)
They are more like command bar executables, like people who have an executer or access to developer console command bar. Heres an image showcasing what I mean
You can prevent them completely by identifying the malicious plugin or model causing them. Most likely its a malicious plugin someone in your development team is using or something weird you inserted.
You can’t prevent them by simply looking for strings such as require(id) using in-game code. This is for two reasons, one is that in-game code can’t see script contents, the other is that those people use very creative ways to run require(id) so they avoid regex detection.
run this in the command bar, it will print all of the requiring of asset IDs. You could change it to remove them:
for _, script in next, game:GetDescendants(), nil do
--modules dont count as base scripts
if not script:IsA("BaseScript") and not script:IsA("ModuleScript") then continue end
if string.match(script.Source, "require%(%d+%)") then
print("Requiring of asset ID found in script", script:GetFullName())
end
end
this could at least help you locate the malicious items, and also whether it’s a plugin or not.