| title | getfunctionhash |
|---|
Returns a deterministic hash of a Luau function's compiled body as a hexadecimal string.
getfunctionhash(func: function): stringThe hash covers the function's compiled bytecode instructions together with its constants. Two functions that compile to the same body with the same constants produce the same hash; changing a single constant changes it.
Most commonly used to fingerprint a function so a later hash mismatch reveals it was hooked or replaced, or to confirm a clonefunction copy still matches the function it was cloned from.
| Parameter | Type | Description |
|---|---|---|
func |
function |
The Luau function to hash. |
string - a 96-character hexadecimal string (SHA-384 over the bytecode and constants). The same function hashes to the same string on every call, and the value stays stable across sessions while the function's code is unchanged.
In an RPG Roblox game, fingerprint a Luau function you located and re-check it later, so you notice if the game swapped it out from under your hook.
local hash = getfunctionhash(print)local target = filtergc("function", {Name = "PurchaseFruit"}, true)
local baseline = getfunctionhash(target)
task.delay(30, function()
if getfunctionhash(target) ~= baseline then
warn("PurchaseFruit was replaced - re-apply your hook")
end
end)