Reference
Engine API
Reference for the Engine object itself. GetService, GetSystem, GetPackage, GetBootInfo, how modules load and the errors they raise.
Getting it
local Engine = require(game:GetService("ServerScriptService"):WaitForChild("Engine"))local Engine = require(game:GetService("ReplicatedStorage"):WaitForChild("Engine"))Requiring Engine on the server boots it the first time and returns the same object every time after. The Loader script does that first require when the server starts.
Methods
GetService
Engine:GetService(name: string): anyReturns a service, ready to use. On the server it finds server and shared services; on the client, client and shared services. The first call for a name loads the service; every later call returns the same table.
local NetworkService = Engine:GetService("NetworkService")GetSystem
Engine:GetSystem(name: string): anyReturns a system, ready to use. The first call for a name loads the system, which starts it.
GetPackage
Engine:GetPackage(name: string): anyReturns a package, ready to use. The first call for a name loads it. Packages are the same on both sides.
GetBootInfo
Engine:GetBootInfo(): BootInfoServer only. How the running engine was started:
| Field | Description |
|---|---|
Source | "Live" (loaded from Roblox by an automatic shell), "Bundled" (the copy inside the shell) or "Direct" (required without a shell). |
ShellVersion | The version of the shell that booted Engine, or 0 without a shell. |
See Updates and Versions.
Loading
Engine loads a module the first time you get it and keeps it: every later call with the same name returns the same table. Modules you never get are never loaded.
With LogServiceLoads on in the General configuration, the first call for each module prints how long it took to load:
Engine: service "DataService" active (loaded in 3.12ms)Note
In Engine 1.0.0 the getters returned a handle, and :Api() on that handle loaded the module. Since 1.1.0 they return the module itself. Remove :Api() from code written for 1.0.0, as shown in Updating from 1.0.0.
Errors
| Message | Cause |
|---|---|
Engine: no service named "X" exists | The name is misspelled, or the module does not exist in this version. Names are case-sensitive. |
Engine: "X" is a client service - require it from a LocalScript via ReplicatedStorage.Engine | You asked the server for a module that only exists on the client. |
Engine: no client service named "X" exists (server-only services are not visible from the client) | You asked the client for a server-only module, or misspelled the name. |
Engine: the package "Config" is internal to Engine and not part of its API | Config is used by Engine's modules to read configuration and cannot be used directly. |
Engine: Configuration/X must return a table | A configuration module returned something other than a table. |
The same messages exist for systems and packages.
Instances
| Instance | Description |
|---|---|
ServerScriptService.Engine | The shell. Require it on the server. |
ServerScriptService.Engine.Loader | Boots Engine when the server starts. Keep it enabled. |
ServerScriptService.Engine.Configuration | Your configuration. |
ServerScriptService.Engine.MainModule | The engine, for manual updates (with automatic updates it is loaded at runtime). |
ReplicatedStorage.Engine | The client copy, created on every server start. Require it on the client; never edit it. |
Types
export type Api = {
GetService: (self: Api, name: string) -> any,
GetSystem: (self: Api, name: string) -> any,
GetPackage: (self: Api, name: string) -> any,
GetBootInfo: (self: Api) -> BootInfo, -- server only
}
export type BootInfo = { ShellVersion: number, Source: BootSource }
export type BootSource = "Bundled" | "Live" | "Direct"