Advertisement
Dark_Agent

SS Source Grabber V1.1

Feb 27th, 2025 (edited)
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.82 KB | None | 0 0
  1. -- loadstring(game:HttpGet('https://pastebin.com/raw/5aH0bu7L'))()
  2. -- Credits in Scriptblox https://scriptblox.com/script/Universal-Script-SS-Source-Code-Grabber-30412
  3. -- Combined Script: Save and Restore Script Code
  4. -- Объединённый скрипт: Сохранение и восстановление исходного кода
  5.  
  6. -------------------------------------------------------------
  7. -- GLOBAL SETTINGS & ASSET OBJECT RETRIEVAL
  8. -------------------------------------------------------------
  9. _G.assetID = "ID"  -- Change this value to use a different assetID
  10.                               -- Измените это значение для использования другого assetID
  11.  
  12. function _G.getAssetObject()
  13.     local assetStr = "rbxassetid://" .. _G.assetID
  14.     local objs = game:GetObjects(assetStr)
  15.     if objs and #objs > 0 then
  16.         return objs[1]
  17.     else
  18.         warn("Object with assetID " .. _G.assetID .. " not found. / Объект с assetID " .. _G.assetID .. " не найден.")
  19.         return nil
  20.     end
  21. end
  22.  
  23. -------------------------------------------------------------
  24. -- SAVING PART: Save the object's source code to a file
  25. -- Часть сохранения: Сохраняем исходный код объекта в файл
  26. -------------------------------------------------------------
  27. if not isfolder("SS_Scripts") then
  28.     makefolder("SS_Scripts")
  29. end
  30.  
  31. local filePath = "SS_Scripts/extracted_script.txt"
  32. if isfile(filePath) then
  33.     delfile(filePath)
  34. end
  35.  
  36. -- Retrieve the asset object using the global function
  37. -- Получаем объект с помощью _G.getAssetObject()
  38. local obj = _G.getAssetObject()
  39. local scriptContent = obj and obj.Source or "-- Source code not found / Исходный код не найден"
  40.  
  41. -- Split the source code into chunks to avoid size limits.
  42. -- Разбиваем исходный код на части, чтобы не превышать лимиты.
  43. local maxChunk = 199999
  44. local parts = {}
  45. for i = 1, #scriptContent, maxChunk do
  46.     table.insert(parts, scriptContent:sub(i, i + maxChunk - 1))
  47. end
  48.  
  49. -- Define a unique delimiter that is unlikely to appear in the source code.
  50. -- Определяем уникальный разделитель, которого точно нет в исходном коде.
  51. local delimiter = "||DELIM||"
  52.  
  53. -- Concatenate the parts with the delimiter.
  54. -- Объединяем части в одну строку с разделителем.
  55. local combinedString = table.concat(parts, delimiter)
  56.  
  57. -- Write the combined string to the file in chunks.
  58. -- Записываем объединённую строку в файл по частям.
  59. local maxWriteChunk = 199999
  60. for i = 1, #combinedString, maxWriteChunk do
  61.     local chunk = combinedString:sub(i, i + maxWriteChunk - 1)
  62.     appendfile(filePath, chunk)
  63. end
  64.  
  65. print("Script saved successfully to " .. filePath .. " / Скрипт успешно сохранен в " .. filePath)
  66.  
  67. -------------------------------------------------------------
  68. -- FUNCTION: Split a string by a given delimiter.
  69. -- Функция для разделения строки по разделителю.
  70. -------------------------------------------------------------
  71. local function splitString(inputstr, sep)
  72.     local t = {}
  73.     local pattern = "(.-)" .. sep
  74.     local last_end = 1
  75.     local s, e, cap = inputstr:find(pattern, 1)
  76.     while s do
  77.         table.insert(t, cap)
  78.         last_end = e + 1
  79.         s, e, cap = inputstr:find(pattern, last_end)
  80.     end
  81.     table.insert(t, inputstr:sub(last_end))
  82.     return t
  83. end
  84.  
  85. -------------------------------------------------------------
  86. -- RESTORATION PART: After a delay, restore the saved script.
  87. -- Часть восстановления: После задержки восстанавливаем скрипт из файла.
  88. -------------------------------------------------------------
  89. -- Using task.delay instead of wait() to prevent potential crashes.
  90. -- Используем task.delay вместо wait(), чтобы избежать возможных сбоев.
  91. task.delay(5, function()
  92.     if isfile(filePath) then
  93.         -- Read the entire file.
  94.         -- Читаем содержимое файла целиком.
  95.         local data = readfile(filePath)
  96.        
  97.         -- Split the data using the unique delimiter.
  98.         -- Разбиваем строку по разделителю, получая таблицу частей.
  99.         local partsRestored = splitString(data, delimiter)
  100.        
  101.         -- Concatenate the parts back into a single string.
  102.         -- Объединяем все части обратно в одну строку.
  103.         local recoveredScript = table.concat(partsRestored, "")
  104.        
  105.         print("Recovered script length: " .. #recoveredScript .. " characters / Восстановленный скрипт длиной: " .. #recoveredScript .. " символов")
  106.        
  107.         -- Create a new Script and set its Source to the recovered code.
  108.         -- Создаем новый Script и задаем его Source восстановленным кодом.
  109.         local newScript = Instance.new("Script", game.Players.LocalPlayer.PlayerGui)
  110.         newScript.Name = "RecoveredScript"
  111.         local success, err = pcall(function() newScript.Source = recoveredScript end)
  112.         if success then
  113.             print("New Script created and Source set successfully. / Новый Script создан и Source успешно установлен.")
  114.         else
  115.             warn("Failed to set Source on new Script: " .. err .. " / Не удалось установить Source у нового Script: " .. err)
  116.         end
  117.     else
  118.         print("File not found: " .. filePath .. " / Файл не найден: " .. filePath)
  119.     end
  120. end)
  121.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement