ReferenceScripts

getscripthash

Returns the SHA-384 hash of the string getscriptbytecode returns for the script.

Syntax

getscripthash(script: LuaSourceContainer) -> string?

Also available as

get_script_hash

Parameters

ParameterTypeDescription
scriptLuaSourceContainerA LocalScript, Script or ModuleScript.

Returns

TypeDescription
string?A 96-character hexadecimal SHA-384 hash, or nil when the script has no bytecode.

Description

The hash changes whenever the script's code changes, so it is a quick way to detect that a game updated a script between sessions without comparing the bytecode yourself.

Example

local script = game.Players.LocalPlayer.PlayerScripts.ClientMain
print(getscripthash(script))

These are Game executor contracts. Check build requirements and session lifetimes before using them.