A General Restriction For Server Addons

Im wondering how to restrict certain functions of addons like the Advanced Duplicator to certain player groups…would something like this work?
[lua]
customCheck = function(ply)
return table.HasValue({“Moderator”, “admin”, “superadmin”, “Supporter”}, ply:GetNWString(“usergroup”))
end,
[/lua]

Also, would it be a server function or client?



local function tooled(ply, tr, tool)
    if ( tool == "adv_duplicator" and !ply:IsAdmin() ) then
        ply:SendLua("GAMEMODE:AddNotify(\"Duplicator is bad. Use Advanced Duplicator to paste shit.\", NOTIFY_HINT, 5)")
        return false
    end
end
hook.Add("CanTool", "restrictdupe", tooled)


I don’t even know if the SendLua works, that’s just something I pulled.

So the check would be server side right at the beginning of the function, right?

CanTool is a shared hook, but in this instance we want to run it server-side, so it should be ran there (i.e. lua/autorun/server).

Thanks dude, you rock