Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to mass select then delete?

Asked by
zomspi 541 Moderation Voter
4 years ago

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!

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 NotZuraax 68 — 4y
0
also place a copy of the two fixed scripts somewhere in order to copy them (using the command bar) NotZuraax 68 — 4y
0
If I do that won't it delete my replacement scripts as well, and it won't be permanent? zomspi 541 — 4y
0
It won't save for every server though, would it? zomspi 541 — 4y
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 NotZuraax 68 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago

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

0
I'll test it thx! zomspi 541 — 4y
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? zomspi 541 — 4y
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? zomspi 541 — 4y
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() NotZuraax 68 — 4y
Ad

Answer this question