#How do I let a script run an a command as admin

1 messages · Page 1 of 1 (latest)

amber wing
#

I know theres the _G.Adonis.RunCommandAsNonAdmin but is there a way to run the command as an admin

alpine pivot
#

Great question

#

Depends on which command you want to run

#

which commands DO you want to run

amber wing
#

hold on ill need some time to think about which ones didnt think it would depend on the command and was asking for future refference

#

cut, setgrav, grav, poison, sfling, and refresh

alpine pivot
#

You’d need to enable _G.Access in the settings

amber wing
#

I do have that enabled

alpine pivot
#

Here’s an example of the script giving admin level 900 to a player named player_name

_G.Adonis.Access("TEST_KEY_SAMPLE", "Admin" ).AddAdmin(game:GetService ("Players")["player_name" ],900)
amber wing
#

whenever calling _G.Adonis.Access its giving me the error of attempt to index nil with 'Access'

alpine pivot
#

are you using the correct key

amber wing
#

yes

alpine pivot
#

hmm

amber wing
#

even when copy pasting that code and just swapping the player name to mine and swapping the key it still gives that error

alpine pivot
#
Functions = _G.Adonis.Access("API Key", "Functions") - Replace Functions with whatever functions you wish to access.
For example,
local Admin = _G.Adonis.Access("TEST_KEY_SAMPLE", "Admin")
Admin.AddAdmin(game:GetService("Players")["player_name"], 900) would give Creator admin to the player called "the_name".```
#

that’s a copy paste

amber wing
#

even when adding nothing but lua Admin = _G.Adonis.Access("(my access key)", "Admin") to a script it produces the error

#

of course with the my access key being swapped out and without the parentheses

finite hull
alpine pivot
#

yea

finite hull
#

fix!!!!

alpine pivot
#

lol no

finite hull
alpine pivot
amber wing
#

ok so is the problem just something with the access key in adonis being messed up or am I understanding this wrong

cold stream
#

Make a plugin that creates a bindable for the function you want to use

alpine pivot
#

That’s just a weird overly complicated workaround

jagged reef
#

Maybe the core access needs to be enabled?

#

not very experienced with adonis so correct me if im wrong

finite hull
#

id rather use a remote to give people admin instead of using the global

jagged reef
#

that would work how?

#

in a plugin? or wdym

finite hull
#
return function(Vargs)
    local server = Vargs.Server
    local service = Vargs.Service
    local Admin = server.Admin
    local Commands = server.Commands
    local Functions = server.Functions
    local Remote = server.Remote

    game:GetService("ServerStorage"):WaitForChild('ServerEvents'):WaitForChild("AddAdmin").Event:Connect(function(p)
        --your code idk
    end)
end
#

using BindableEvent

jagged reef
#

hmm

#

alright