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

# getscripthash

Returns a SHA-384 hash of a script's bytecode. Most commonly used to detect when a script's source has been modified or recompiled.

```luau theme={null}
getscripthash(script: LuaSourceContainer): string
```

## Parameters

| Parameter | Type                                                                                               | Description         |
| --------- | -------------------------------------------------------------------------------------------------- | ------------------- |
| `script`  | [`LuaSourceContainer`](https://create.roblox.com/docs/reference/engine/classes/LuaSourceContainer) | The script to hash. |

## Returns

`string` - a 96-character hexadecimal string (48 bytes).

## Example

<CodeGroup>
  ```luau Example 1 theme={null}
  <<<<<<< HEAD
  local hash = getscripthash(workspace.Part.LocalScript)
  =======
  -- getscripthash(script: LuaSourceContainer): string
  >>>>>>> 50e30f53759b0538759af25c9b271514aa2c9290
  ```

  ```luau Example 2 theme={null}
  local animate = cloneref(game:GetService("Players")).LocalPlayer.Character.Animate
  local hash = getscripthash(animate)

  while task.wait(0.5) do
      local newHash = getscripthash(animate)
      if newHash ~= hash then
          print("Script has changed - re-hooking.")
          hash = newHash
      end
  end
  ```
</CodeGroup>

<Tip>
  Comparing two hashes is much cheaper than comparing the bytecode strings returned by `getscriptbytecode`. Good for polling loops.
</Tip>
