So I am using CMDR for my SCP-like game, kindof for a purpose like the game Pathos-III, my terminal used to work perfectly but now it says “CMDR disabled for security: BeforeRun hook not setup”
From my experience you need to do these 2 things, create a module script with the BeforeRun hook taken from documentation
-- A ModuleScript inside your hooks folder.
return function (registry)
registry:RegisterHook("BeforeRun", function(context)
if context.Group == "DefaultAdmin" and context.Executor.UserId ~= game.CreatorId then
return "You don't have permission to run this command"
end
end)
end
Then in your CMDR server script run the function.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Cmdr = require(ReplicatedStorage.Shared.Cmdr)
Cmdr:RegisterDefaultCommands() -- This loads the default set of commands that Cmdr comes with. (Optional)
Cmdr:RegisterHooksIn(ReplicatedStorage.Shared.CmdrHooks) --Run this module script hook function
the CMDR used to work completley fine, but i recently started to continue a game.
Inside of BeforeRun, I currently have return function(registry)
registry:RegisterHook(“BeforeRun”, function(context)
local CanRun = false
local player = game.Players:WaitForChild(context.Executor.Name)
local groupRank = player:GetRankInGroup(15775498)
if context.Group == "OWI Staff" or
context.Group == "Site Director+" or
context.Group == "Help" or
context.Group == "General" or
context.Group == "DefaultUtil" then
CanRun = true
elseif context.Group == "Developer" then
CanRun = groupRank > 253
elseif context.Group == "Admin" then
CanRun = groupRank > 50
end
if not CanRun then
return "You don't have permission to run this command."
end
end)
end