HD admin script

Hello

i have HD admin in my new game . in this game everyone can use admin commands but there’s admins also and owner

is there’s a way that i prevent normal people from using commands on admins and owner ?

for example if someone using ( fling owner ) can i prevent that command from working on owner ? and only works on normal people ?

sorry for my English and thanks
also sorry if this is not right section im kinda new

Maybe make a script that automatically boots the user out of the game once saying “:fling owner”?

this could work but the problem is i don’t want them out the game i just want to stop the command from working when normal person use it on admin or owner and work when normal person use it on another normal person

just to be clear i want all HD admin commands stop working on admins and owner

Maybe restrict the fling command only to admins and owners?

1 Like

I got what you need!!
First, create a Module Script, and place it in HD Admin/CustomFeatures/Server/Modules.
NOTE: You have to name it FlingProtection

ModuleScript:

local FlingProtection = {}

local function HasAdminPermission(player)
    local adminRole = game:GetService("Teams"):FindFirstChild("Admins")
    if adminRole and player:IsInGroup(adminRole.GroupId) then
        return true
    end

    return false
end

function FlingProtection.CheckFlingPermission(player, targetPlayer)
    local isAdmin = HasAdminPermission(player)
    local isTargetAdmin = HasAdminPermission(targetPlayer)

    if isAdmin and isTargetAdmin then
        return false
    end

    return true
end

return FlingProtection

Now, you have to create a Script and place it in ServerScriptService

Script:

local HDAdmin = require(game:GetService("ServerScriptService").HDAdmin)
local FlingProtection = require(script.Parent.Modules.FlingProtection)

HDAdmin:RegisterCommand({
    Commands = {"fling"},
    Description = "Fling the target player.",
    Group = "Default",
    Function = function(player, targetPlayer)
        if FlingProtection.CheckFlingPermission(player, targetPlayer) then
            print("Flinging target player:", targetPlayer.Name)
        else
            print("You cannot use this command on other admins.")
        end
    end
})
1 Like

tyvm!! i will try that i’ve been looking for this for months

ok instead of fling how can i do this to all HD admin commands ?

1 Like

If you’ve been using free models I’d look into learning some more code, then you could configure the code more easily.

Infact, if you disect the HD admin code its alot easier to understand than you think. For example you can configure whos admin and whos not without using ;permrank user rank.