Skip to content
Dimenpsyonal edited this page Aug 11, 2024 · 16 revisions

First of all, what is the _G API?
The _G API is an API which allows scripts to interact globally. Adonis uses this to create select functions that can be interacted with by any server script, meaning any server script can access certain Adonis events using _G.Adonis.

Table of Contents

Using the API

Settings

To start, you need to have the appropriate settings enabled.

  • settings.G_API = true This needs to be set to true so that the _G.Adonis API can be used.
  • settings.G_Access = false This is optional for security, can be left false if you want. This controls whether scripts need an access key to use _G.Adonis.
  • settings.G_Access_Key = "Example_Key" This can be used to set an access key if the above setting is set to true. Example_Key is excluded and will not work.
  • settings.G_Access_Perms = "Read" This controls what permissions other scripts have over the _G API, read or write.

Usage in scripts

With _G.Access disabled

  • _G.Adonis.Function(Input, Player(s))
For example,

_G.Adonis.Hint("Message", game.Players:GetPlayers()) would create a hint for all players with the word "Message".

With _G.Access enabled

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

Functions

These are all the functions you can use with _G.Adonis. Most of them are self-explanatory.

Function Description Usage
Some arguments are optional.
CheckAdmin / IsAdmin Checks if a player... is an admin. Obviously. _G.Adonis.CheckAdmin(player)
CheckBan / IsBanned Checks if a player is banned. _G.Adonis.CheckBan(player)
IsMuted Checks if a player is muted. _G.Adonis.IsMuted(player)
CheckDonor Checks if a player is a donor. _G.Adonis.CheckDonor(player)
GetLevel Gets the player's admin level. _G.Adonis.GetLevel(player)
SetLighting Sets the game lighting. _G.Adonis.SetLighting(property, value)
SetPlayerLighting Sets the lighting for an individual player. _G.Adonis.SetLighting(player, property, value)
NewParticle Creates a new particle effect on a player. _G.Adonis.NewParticle(player, particleType, properties)
RemoveParticle Removes a particle effect from a player. _G.Adonis.NewParticle(player, particleName)
NewLocal Removes a particle effect from a player. _G.Adonis.NewLocal(player, class, properties, parent)
MakeLocal Makes an object local. _G.Adonis.MakeLocal(player, object, parent, isClone)
MoveLocal Moves a local object from one player to another. _G.Adonis.MoveLocal(player, object, parent, newParent)
RemoveLocal Removes a local object. _G.Adonis.RemoveLocal(player, object, parent, shouldMatch)
Hint Makes a hint. _G.Adonis.Hint(message, players, duration, title, image)
Message Makes a big message. _G.Adonis.Message(sender, title, message, image, players, scroll, duration)
RunCommandAsNonAdmin Runs a command as if the player was a non-admin _G.Adonis.RunCommandAsNonAdmin(command, plr, ...)