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

1 Like

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

1 Like

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

1 Like

Maybe restrict the fling command only to admins and owners?

2 Likes

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
})
2 Likes

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 ?

2 Likes

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.

1 Like