Checking All Of A Game For A Object

Is it possible to check the whole game for an object? Ex: Checking the whole game to see if there is something called a virus and if so you can delete it.

You can use :GetDescendants() on the workspace and go through that table and check for a name like that to delete.

2 Likes

Yes, with a for loop and GetChildren or GetDescendants

1 Like

Is there a way to delete just one of them if there is 2 lets say?

for i, obj in pairs(workspace:GetDescendants()) do
       obj:Destroy()
end

This is a small exemple, here the for loop will choose one object by one in the workspace and destroy it

You can do a quick boolean/number count if you just wanna delete one but if you want to specifically only delete one you should check if it has properties similar to the script you don’t want to delete.

Is there a way to check all characters for something? Here is my main forum I was trying to make but no one answered Checking All Characters For Objects