Skip to content

Utilities

Various functions for use in many different files. Somewhat mirrored with the server module.

Utilities.GetSetting

Gets a setting from the Administer settings index regardless of category.

WARNING

If you are loading settings at runtime, they might not be loaded yet. Implementing GetSettingChanged or Var.Remotes.SettingsLoaded.OnClientEvent:Wait() is never a bad idea.

luau
Utilities.GetSetting(
    Setting: string
): any
luau
local Language = Utilities.GetSetting("Locale")

print({
    "en": "Hello!",
    "es" = "Hola!",
    "fr" = "Bonjour!"
}[Language])

Utilities.GetSettings

Acts like GetSetting, but rather than a string setting ID a dictionary of settings is accepted.

WARNING

If you are loading settings at runtime, they might not be loaded yet. Implementing GetSettingChanged or Var.Remotes.SettingsLoaded.OnClientEvent:Wait() is never a bad idea.

luau
Utilities.GetSettings(
    { Setting: string }
): { any }
luau
local Settings = Utilities.GetSettings({"Locale", "AnimationSpeed"})

task.wait(Settings.AnimationSpeed)

print({
    "en": "Hello!",
    "es" = "Hola!",
    "fr" = "Bonjour!"
}[Settings.Locale])

Utilities.GetSettingChanged

Returns a RemoteEvent which is fired every time a setting is changed.

luau
Utilities.GetSettingChanged(
    Setting: string
): RemoteEvent?
luau
Utilities.GetSettingChanged("AnimationSpeed").OnClientEvent:Connect(function(NewValue)
    print(`The animation speed is now {NewValue}!`)
end)

Utilities.ShortNumber

Gets a minified number.

luau
Utilities.ShortNumber(
    Number: number
): string
luau
local BigNumber = 875834923

script.Parent.Text = Utilities.ShortNumber(BigNumber) --// -> 875.8M

Utilities.FormatRelativeTime

Takes a Unix timestamp (1752386926) and converts it to a relative timestamp (4 minutes ago)

Strings are automatically translated using a user's locale.

luau
Utilities.FormatRelativeTime(
    UnixDate: number
): string
luau
print(`This documentation entry was written {Utilities.FormatRelativeTime(
    1752386926
)}`) --// This documentation entry was written 3 minutes ago

Utilities.Logging.Print

Prints something out.

luau
Utilities.Logging.Print(
    ...
)

Utilities.Logging.Warn

Creates a warning with a traceback.

luau
Utilities.Logging.Warn(
    ...
)

Utilities.Logging.Error

Creates an error.

luau
Utilities.Logging.Error(
    Message: string
)

Utilities.NewNotification

Creates a new notification.

luau
Utilities.NewNotification(
    AppTitle: string,
	Icon: string,
	Body: string,
	Heading: string,
	Duration: number?,
	Options: { {
        Text: string,
        Icon: string,
        OnClick: () -> ()
    }? }?
): string
luau
Utilities.NewNotification(
    "Administer",
    Utilities.Icon "administer",
    "This is a test of the notification system.",
    "Test",
    15,
    {{
        Text = "Cool",
        Icon = Utilities.Icon "like",
        OnClick = print
    }}
)

Utilities.CreateReflection

Creates a reflected image.

luau
Utilities.CreateReflection(
    ImageURL: string
): EditableImage
luau
script.Parent.Image = Utilities.CreateReflection(Utilities.Icon("thumbs-up"))

Utilities.Translate

Gets a translated string based on its identifier. Prefers the users Roblox locale but overriding via Settings is possible. If the string was not found, it will return the identifier back.

luau
Utilities.Translate(
    Identifier: string
): string
luau
print(Utilities.Translate("generic.ThankYou")) --// -> Gracias!
print(Utilities.Translate("generic.strings.DoesNotExist")) --// -> generic.strings.DoesNotExist

Utilities.Icon

Gets an Icon and returns its asset URL. If the icon is not valid to the current selected pack, rbxassetid://nil is returned.

luau
Utilities.Icon(
    IconName: string
): string
luau
script.Parent.Image = Utilities.Icon "user" --// -> rbxassetid://15317920838
script.Parent.Image = Utilities.Icon "middle_finger" --// -> rbxassetid://nil

Utilities.ToSentenceCase

Takes in a sentence and turns it into sentence case. Does not preserve anything after the first letter, so you might want to concentrate other proper nouns.

luau
Utilities.ToSentenceCase(
    Sentence: string
): string
luau
print(Utilities.ToSentenceCase("hello, bob!")) --// Hello, bob!
print(Utilities.ToSentenceCase("SCRIPT ERRORS MAKE ME ANGRY.")) --// Script errors make me angry.
print(Utilities.ToSentenceCase("I love reading the Administer Documentation.")) --// I love reading the administer documentation.
print(Utilities.ToSentenceCase("i love it when i have to use the")..Utilities.ToSentenceCase("administer api")) --// I love it when i have to use the Administer api

Utilities.Heartbeat

Spawns Administer's internal heartbeat function.

WARNING

Not for external use.

luau
Utilities.Heartbeat(): ()
luau
task.defer(Utilities.Heartbeat)

Utilities.ProcessDono

Internal wrapper for processing donations and showing confetti if it was purchased.

WARNING

Not for external use.

luau
Utilities.ProcessDono(
    Player: Player,
	GamePassId: number, 
	WasPurchased: boolean
): ()
luau
Var.Services.MarketplaceService.GamePassPurchaseCompleted:Connect(Utilities.ProcessDono)