Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to mass select then delete?

I'm sorry, this isn't scripting related but I don't know where else to post this. If anyone can tell me how I can mass delete items in the Explorer I would forever be grateful!

More Detail:

I have a folder with like 200 - 300 parts in it, each of those parts have 2 scripts in them, I made an error in 1 line of the scripts and need to replace it, how can I do this quickly without manually deleting every single one!

This is what I want to do (delete the selected): https://ibb.co/qMd8c6x

Except there are nearly 3 - 4 times the amount of Fields shown on the picture, each Field has the 2 scripts I want to delete: https://ibb.co/DgrfvWh

I would greatly appreciate anyone helping me, or guiding me to a site where I cold post this issue, thanks!

5 comments

0

Use the console below (it's below for me, if you didn't activate it, go in view > enable 'Command Bar') and try using a script script with for_, v in pairs(game.Workspace:GetChildren()) do or something similar

0

also place a copy of the two fixed scripts somewhere in order to copy them (using the command bar)

0

If I do that won't it delete my replacement scripts as well, and it won't be permanent?

0

It won't save for every server though, would it?

0

Don't run the game before using the command bar, else it won't save. Then you'll just need to save & publish the game, and finally restart it for every changes to apply

1 answer

✓ Accepted answer

Here's an example of what you could do :


for _, child in pairs(game.Workspace.TestFolder:GetChildren()) do
     if child.Name == "RandomPart" then
          if child:FindFirstChild("NonWorkingScript") then -- Detect the specific thing you want to delete
          child.NonWorkingScript:Destroy()

          local fixedScript = game.Workspace.WorkingScript:Clone() -- Clone the fixed script placed here in Workspace
          fixedScript.Parent = child -- Place the cloned script inside child (here named RandomPart)
          end
     end
end

Instruction : change the script for it to work for you then copy/paste it in the command bar when the game isn't running (you still must be in the Editing mode, not the Testing one), save & publish, restart the game and everything should be done

4 comments

0

I'll test it thx!

0

Quick question, do you need a :WaitForChild() on a variable, cus my error says unable to find "object", or does it eventually find it?

0

Quick question, do you need a :WaitForChild() on a variable, cus my error says unable to find "object", or does it eventually find it?

0

You can try using a :WaitForChild() but only if you're sure the object will appear (for example, when launching the game, it sometimes need time to load every single parts). If it still doesn't find the object after a certain amount of time, it will cause an error, so be careful with :WaitForChild()

This discussion is preserved as it was. New answers, comments, and votes are closed.