getscripthash
Returns a SHA-384 hash of the compiled bytecode of a script.
function getscripthash(script: Script | LocalScript): stringSynopsis
How it works
Reads the script's compiled bytecodeBytecodeThe compiled binary representation of Luau source code. A sequence of 32-bit instructions (opcodes + operands) stored in a Proto's code[] array. Executed by the Luau VM interpreter. (same as
getscriptbytecode), then computes a SHA-384SHA (hash family)Secure Hash Algorithm family: SHA-1 (160-bit, broken), SHA-256/SHA-384/SHA-512 (SHA-2 family, secure), SHA3-256 (Keccak-based). Used by crypt.hash() to produce fixed-size digests from arbitrary input data. cryptographic hash over the raw bytes. Returns the hash as a 96-character hex string. This provides a stable fingerprint that changes only when the script's source code is modified.Integrity checking
Use this to detect if a game script has been updated between sessions or modified at runtime by another executor/cheat. Compare the hash against a known baseline to verify integrity.
Usage
Verify script integrity
local hash = getscripthash(game.Players.LocalPlayer.PlayerScripts.SomeScript)
print(hash) "cc">--> "3d9e7f2b..."Parameters
script Script | LocalScript The script to hash.
Returns
string Hex-encoded SHA-384 hash of the script bytecode.