local refs = {}
local bannedScripts = game:GetService("Players").LocalPlayer.PlayerGui
refs.__namecall = hookmetamethod(game, "__namecall", function(...)
local caller = getcallingscript()
-- Use '.' notation to call the IsDescendantOf method without invoking
-- __namecall and causing a recursive loop.
local isBanned = caller.IsDescendantOf(caller, bannedScripts)
if isBanned then
error("Not allowed to invoke __namecall")
end
return refs.__namecall(...)
end)
function getnamecallmethod(): string
local refs = {}
refs.__namecall = hookmetamethod(game, "__namecall", function(...)
local self = ...
local method = getnamecallmethod()
if self == game and method == "service" then
error("Not allowed to run game:service()")
end
return refs.__namecall(...)
end)
function isreadonly(object: table): boolean
local object = {}
table.freeze(object)
print(isreadonly(object)) --> true
function setrawmetatable(object: table, metatable: table): ()