Josiahiscool73

game dumper for script making

Dec 18th, 2025
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.77 KB | None | 0 0
  1.  
  2.  
  3. -- config
  4. local file_name = "GameDump_Decompiled.txt"
  5. local player_name = "USER"
  6.  
  7. -- helper function to get the full path of an object
  8. local function get_path(obj)
  9. local path = {}
  10. while obj and obj ~= game do
  11. table.insert(path, 1, obj.Name)
  12. obj = obj.Parent
  13. end
  14. return "game." .. table.concat(path, ".")
  15. end
  16.  
  17. -- helper function to get a script's source, using the decompiler as a backup
  18. local function get_source(script)
  19. local source = script.Source
  20. if source and #source > 0 then
  21. return source
  22. end
  23.  
  24. -- if .Source is empty or protected, fall back to the decompiler
  25. if decompile then
  26. local success, result = pcall(decompile, script)
  27. if success then
  28. return result
  29. else
  30. return "--[[ DECOMPILER FAILED: " .. tostring(result) .. " ]]--"
  31. end
  32. end
  33.  
  34. return "--[[ ERROR: Could not get source and 'decompile' is not available. ]]--"
  35. end
  36.  
  37.  
  38. -- // main // --
  39.  
  40. -- rename the player
  41. local lp = game:GetService("Players").LocalPlayer
  42. local old_name = lp.Name
  43. lp.Name = player_name
  44.  
  45. -- what we want to scan
  46. local services_to_scan = {
  47. ReplicatedStorage = game:GetService("ReplicatedStorage"),
  48. Workspace = game:GetService("Workspace"),
  49. StarterGui = game:GetService("StarterGui"),
  50. Players = game:GetService("Players"),
  51. Lighting = game:GetService("Lighting"),
  52. StarterPack = game:GetService("StarterPack"),
  53. }
  54.  
  55. local hierarchy_dump = {}
  56. local scripts_dump = {}
  57.  
  58. print("Dumping game... this might take a sec.")
  59.  
  60. for _, service in pairs(services_to_scan) do
  61. if not service then continue end
  62.  
  63. for _, descendant in ipairs(service:GetDescendants()) do
  64. local path = get_path(descendant)
  65.  
  66. -- log the object's path and class
  67. table.insert(hierarchy_dump, string.format("%s | %s", path, descendant.ClassName))
  68.  
  69. -- if it's a client-side script, grab its source
  70. if descendant:IsA("LocalScript") or descendant:IsA("ModuleScript") then
  71. local source = get_source(descendant)
  72. table.insert(scripts_dump, {
  73. Path = path,
  74. Class = descendant.ClassName,
  75. Source = source
  76. })
  77. end
  78. end
  79. end
  80.  
  81. print("Scan finished. Building the text file...")
  82.  
  83. -- build the final output file
  84. local final_dump = {
  85. "-- Game Dump --",
  86. string.format("-- User: %s (was %s)", player_name, old_name),
  87. string.format("-- Time: %s (UTC)", os.date("!%Y-%m-%d %H:%M:%S")),
  88. "\n------------------------------------------",
  89. "-- HIERARCHY",
  90. "------------------------------------------\n",
  91. table.concat(hierarchy_dump, "\n"),
  92. "\n\n------------------------------------------",
  93. "-- SCRIPTS (LocalScripts & ModuleScripts)",
  94. "------------------------------------------\n"
  95. }
  96.  
  97. -- add the formatted script sources
  98. for _, data in ipairs(scripts_dump) do
  99. table.insert(final_dump, string.format("-- Path: %s\n-- Class: %s\n--[[ SOURCE ]]--\n\n%s\n\n--[[ END SOURCE ]]\n------------------------------------------\n", data.Path, data.Class, data.Source))
  100. end
  101.  
  102. local full_output = table.concat(final_dump, "\n")
  103.  
  104. -- attempt to write file, with clipboard as a fallback
  105. if writefile then
  106. writefile(file_name, full_output)
  107. print(string.format("Success! Saved everything to '%s'.", file_name))
  108. else
  109. if setclipboard then
  110. setclipboard(full_output)
  111. print("Couldn't save to a file, but that's okay.")
  112. print("Success! Copied everything to your clipboard. Paste it in a notes app!")
  113. else
  114. warn("FATAL: Your executor doesn't support 'writefile' or 'setclipboard'.")
  115. print("You'll have to copy the log from your console manually.")
  116. end
  117. end
Advertisement
Add Comment
Please, Sign In to add comment