Note: This is not intended to be a virus this is just a script I am working on for fun. I would just like to know if it is possible to make this run on less lines of code, this is the shortest I can think of right now. Any and all ideas are appreciated!
function Mute(object, script)
if
object:IsA("Script") or object:IsA("LocalScript") or object:IsA("ModuleScript") then
object.Disabled = true
end
for _, Child in ipairs(object:GetChildren()) do
Mute(Child, script)
end
end
Mute(game.Workspace)

4 comments
I've heard that by not using IsA() and using if object.ClassName == ClassName is more efficient. I can't promise that is true but it might be.
@AZDev I've not tested that, nor have I heard anything like that. If it were to be inefficient, then it must not leave too much impact on the game. As for the script, I can not think of how to make it any more efficient. I can however state there is no disabled property of ModuleScripts.
You could argue that comparing it's class name with a string is "more efficient", but micro-optimizing your code to death is much worse. Yes there is more going on behind the scenes while using a function call, but this is why the option exists.
@M39a9am3R Thank you for that i never checked