Skip to content

Instantly share code, notes, and snippets.

@depthso
Last active March 5, 2026 14:16
Show Gist options
  • Select an option

  • Save depthso/cd1d687982265ca1ee3bf9b3980b998a to your computer and use it in GitHub Desktop.

Select an option

Save depthso/cd1d687982265ca1ee3bf9b3980b998a to your computer and use it in GitHub Desktop.
(⚠️ PATCHED BY ROBLOX)! Detect hooking such as hookmetamethod. You could also detect the executor's env with a __tostring metatable through a bindable event but some like Zenith have patched this.
-- ⚠️ PATCHED BY ROBLOX
local StackCount = 0
local function Overflow()
StackCount += 1
if StackCount > 195 then
game:GetService("Workspace")
end
--// Recursively until it errors
coroutine.wrap(Overflow)()
end
local function CountMatches(String: string, Match: string): number
local Count = 0
for _ in String:gmatch(Match) do
Count += 1
end
return Count
end
while wait(1) do
local _, Error = pcall(Overflow)
local Count = StackCount
local Matches = CountMatches(Error, script:GetFullName())
StackCount = 0
--// Mismatch detection
if Count ~= Matches then
warn("Hooks detected thx")
break
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment