> ## 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

> Roblox script を decompile し、bytecode が利用できる場合は生成された source text を返します。argument は対応している script Instance である必要があります。使用できる bytecode がない場合、この function は nil を返します。

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

  ## 引数

  <ParamField path={"script"} type={"userdata"} required>
    decompile する Script object。対応する ClassName values は ModuleScript、LocalScript、CoreScript、RunContext Client の Script です。
  </ParamField>

  ## 戻り値

  <ResponseField name={"source"} type={"string | nil"}>
    Decompiler output string、caught decompiler exception text、または usable embedded bytecode がない場合は nil。
  </ResponseField>

  ## 例

  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>
