> ## Documentation Index
> Fetch the complete documentation index at: https://docs.projectreal.gg/llms.txt
> Use this file to discover all available pages before exploring further.

# decompile

> Decompile một Roblox script và trả về source text được tạo khi có bytecode. argument phải là script Instance được hỗ trợ. Nếu không có bytecode dùng được, function trả về nil.

<div className="real-function-page">
  ```lua theme={null}
  decompile(script: userdata): string | nil
  ```

  ## Đối số

  <ParamField path={"script"} type={"userdata"} required>
    Script object can decompile. Cac gia tri ClassName duoc ho tro la ModuleScript, LocalScript, CoreScript va Script voi RunContext Client.
  </ParamField>

  ## Giá trị trả về

  <ResponseField name={"source"} type={"string | nil"}>
    Decompiler output string, caught decompiler exception text, hoac nil khi khong co usable embedded bytecode.
  </ResponseField>

  ## Ví dụ

  Decompile a supported Roblox script Instance. To decompile a whole game, iterate its descendants or use a saveinstance workflow.

  ```lua theme={null}
  local targetScript

  for _, descendant in ipairs(game:GetDescendants()) do
      if descendant:IsA("LuaSourceContainer") then
          targetScript = descendant
          break
      end
  end

  if targetScript then
      local source = decompile(targetScript)

      if source then
          print(source)
      end
  end
  ```
</div>
