--------------Create-----------------------------
local toolbar = plugin:CreateToolbar("PV")
local UpdateButton = toolbar:CreateButton("Update", "Update public values in scripts.", "rbxassetid://6808848852")
local PV = game.ServerStorage.Plugins.PV
----------------Run-------------------------
function RemoveFirstLine(ReqString:string)
return string.sub(ReqString,string.find(ReqString,"\n",1),-1)
end
function DestroyAnnotation(ReqString:string)
local lines =string.split(ReqString,"\n")
for i,v in pairs(lines) do
lines[i] = v:gsub("%-%-+.+","")
end
return table.concat(lines," ")
end
local Running = false
UpdateButton.Click:Connect(function()
if not Running then
Running = true
print("Start Updating")
local PublicSourceWithoutAnnotation = DestroyAnnotation(PV.Public.Source)
do --All Script--
local Research = {workspace,game.ServerStorage,game.ServerScriptService,game.ReplicatedStorage,game.StarterGui,game.StarterPlayer}
local new = PublicSourceWithoutAnnotation..string.format("\n")
for n1,v1 in pairs(Research) do
for n2,Script in pairs(v1:GetDescendants()) do
if (Script:IsA("Script") or Script:IsA("ModuleScript")) and not Script:IsDescendantOf(game.ServerStorage.Plugins) then
Script.Source = new.. RemoveFirstLine(Script.Source)
wait(.5)
end
end
end
end
print("Update Completed")
Running = false
end
end)
It change the first line of all scripts in my game to the code that i want to write in scripts.
But IT’S TOO LAGGY
I can’t know the cause…
One run about a long script takes 8.082389831543e-05 seconds.
However, running about each scripts every 0.5 seconds causes the computer to melt.
Could you help me?