Let's fix the toolbox model cleaner plugin we made!
Let's fix the toolbox cleaner plugin we made the last video. In the last video we made our own plugin that can clean all the scripts inside a model, so we can use toolbox assets safely. But we couldn't fix the ChangeHistoryService bug so we can revert back deleted scripts if somehow you deleted an important script. and also the plugin wasn't able to remove modulescripts since it's a base script. However the 3 forms of scripts share one super base class which is "LuaSourceContainer". So I posted the issue we had in devforum about ChangeHistoryService: https://devforum.roblox.com/t/changehistoryservice-doesnt-work-properly/795588 And after 6 hours 3 people helped me identify and solve the problem!
Watch the last video if you didn't before watching this one: https://youtu.be/dA647-8bFS0
The new source code:
local SelectionService = game:GetService("Selection") local ChangeHistoryService = game:GetService("ChangeHistoryService")
local Toolbar = plugin:CreateToolbar("ToolboxCleaner") local CleanScriptsButton = Toolbar:CreateButton("CleanScripts", "Select a model to clean all it's descendant scripts", "rbxassetid://3610247188")
local function CleanScriptsButtonClicked() local Selection = SelectionService:Get() ChangeHistoryService:SetWaypoint("Scripts cleaning") for i, SelectedInstance in pairs(Selection) do for i, element in pairs(SelectedInstance:GetDescendants()) do if element:IsA("BaseScript") then element.Disabled = true element.Parent = nil elseif element:IsA("ModuleScript") then element.Parent = nil end end end ChangeHistoryService:SetWaypoint("Scripts cleaned") end
CleanScriptsButton.Click:Connect(CleanScriptsButtonClicked)
Fixed plugin's model: https://www.roblox.com/library/5758101836/
Fixed plugin: https://www.roblox.com/library/5758109407/Cleaner-Plugin-2
Help me make videos more frequently by donating in PayPal! https://www.paypal.com/paypalme/CodesOtaku
Join my discord server: https://discord.gg/mxqM4hf
Thanks for watching. and if you have any questions or suggestions. I'll be happy to answer! ... https://www.youtube.com/watch?v=z6TMUcAAcsk
71498468 Bytes