1zxyuuki

Savein

Apr 9th, 2025 (edited)
15
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. -- cleaner version
  2. -- repo at https://github.com/speedstarkawaii/decompile-modulescript
  3. -- v3 soon
  4. -- output cleaner on this one
  5.  
  6. function decompile(module_path)
  7. local result = ""
  8.  
  9. local module_script = module_path
  10.  
  11. if not module_script:IsA("ModuleScript") then
  12. error("this decompiler only works on ModuleScript not other userdata") -- yea i should just return this at result
  13. end
  14.  
  15. local module = require(module_script)
  16.  
  17. result = "-- Decompiled with speed's decompiler\n-- ModuleScript are the only script supported" .. "\n\nreturn {\n"
  18.  
  19. if type(module) == "table" then
  20. for key, value in pairs(module) do
  21. result = result .. " " .. key .. " = " .. tostring(value) .. ",\n"
  22. end
  23. result = result:sub(1, -3) .. "\n"
  24. result = result .. "}\n"
  25. else
  26. result = "-- Decompiled with speed's decompiler\n-- Is the ModuleScript nil?\n\nreturn {\n}"
  27. end
  28.  
  29. return result
  30. end
Add Comment
Please, Sign In to add comment