admins = {
[40527673] = true,
[482217345] = true
}
return function (registry)
registry:RegisterHook("BeforeRun", function(context)
if context.Group == "DefaultAdmin" and not admins[context.Executor.UserId] then
return "You don't have permission to run this command"
end
if context.Group == "Moderator" and not (context.Executor:GetRankInGroup(3904755) == 4) then
return "You don't have permission to run this command"
end
registry:RegisterHook("AfterRun", function(context)
print(context.Response)
return "Command has been run."
end)
end)
end
This is what i’ve tried to do, have a list of admins and moderators by group rank
The problem is with the command group property, how do i allow for multiple groups to use that one command?
Like if i wanted both mod and admin to be able to use /fly then what would i change in Group = “DefaultAdmin”;?
If you want administrators to use commands under the Moderator group, add and not admins[context.Executor.UserId] to the if statement checking if the command’s group is Moderator.
Side note, you should remove the AfterRun hook if you are not using it.
Yes, the project is still maintained. Cmdr is mostly stable, there are some new changes if you build from source. I’ll cut a new release here in a few weeks, probably.
I don’t like the fact that Cmdr magically parents itself to a bunch of replicated Instances on require. I have a use case where I’d prefer for it to be impossible to detect Cmdr’s existence from any client that doesn’t have access to the console. This is currently possible by using a pool of Cmdr instances that were initialized on server startup, before any players have joined, and then had their instances yoinked from StarterGui and ReplicatedStorage, but that is like the hackiest hack I’ve ever done and it’s utterly disgusting.
The point of controlling what is replicated to the client is to prevent exploiters from seeing what you don’t want them to. I don’t want them to know my place has an admin console. Cmdr could support that use case, but it doesn’t.
I already have hooks to prevent unauthorized usage. I just don’t want a huge pile of ModuleScripts to be replicated to every client when only authorized devs can actually use it.
It’s not like exploiters can use the modulescripts for bad (assuming Cmdr is secure), so there is really no reason to worry about replication when the source code is online…