Using the API
HD Admin's internals are constantly changing so it's essential your game code never touches anything directly within the MainModule. This is where the APIs come in handy. They wrap useful behaviours behind functions that remain the same so that your code never breaks in future updates.
Getting the API¶
From a server Script:
local hd = game:GetService("ReplicatedStorage"):WaitForChild("HD Admin")
local ServerAPI = require(hd.Core.ServerAPI)
From a client LocalScript:
local hd = game:GetService("ReplicatedStorage"):WaitForChild("HD Admin")
local ClientAPI = require(hd.Core.ClientAPI)
From a command module (ConfigCommands):
local CommandAPI = require(script:FindFirstAncestor("HD Admin").Core.CommandAPI)
This works, no matter where your model is located, because HD Admin moves its shared files into ReplicatedStorage when the game starts.
Tip
If you'd like type checking and autocompletes when using the API, move your HD Admin model into ReplicatedStorage
Reference pages¶
| Task API | The task object your commands receive |
| Command API | Everything a command module can safely reference |
| Server API | Commands, roles, moderation, emotes, prompts and settings from server Scripts |
| Client API | The panel, prompts and settings from LocalScripts |
Info
If you'd like a specific function added, open an issue on our GitHub.