Source: Roblox Creator Hub · CC BY 4.0 · View source · Code samples: MIT Imported 2026-10-03. Formatting adapted for this site.
Roblox globals
Roblox provides several unique built-in functions and variables in its embedding of Luau. These are only found on Roblox and are not packaged by default with Luau or Lua.
Properties
| Name | Type / Returns | Description |
|---|---|---|
| Enum | Enums | Contains all Enum objects. |
| game | DataModel | Refers to the DataModel singleton, the root instance of a place's hierarchy. |
| plugin | Plugin | Refers to a Plugin singleton when the code is run in the context of a Studio plugin. |
| shared | Array | A table shared between all code running at the same execution context level. |
| script | LuaSourceContainer | A reference to the LuaSourceContainer object (Script, LocalScript, or ModuleScript) that is executing this code. |
| workspace | Workspace | A reference to the Workspace service, which contains all of the physical components of a place. |
Enum
A reference to the Enums data type, which stores all of the available enums that can be used on Roblox.
| Field | Value |
|---|---|
| type | Enums |
game
A reference to the DataModel, which is the root Instance of Roblox's parent/child hierarchy.
| Field | Value |
|---|---|
| type | DataModel |
plugin
A reference to the Plugin object that represents the plugin being run from this Script. This reference exists only in the context where a script is executed as a plugin and is not passed to ModuleScripts within the plugin. To use this reference in a ModuleScript, you must explicitly pass it.
| Field | Value |
|---|---|
| type | Plugin |
Code samples: View on Creator Hub (RobloxGlobals-plugin).
shared
A table that is shared across all scripts that share the same execution context level. This serves the exact same purpose as _G.
| Field | Value |
|---|---|
| type | Array |
script
A reference to the script object that is executing the code you are writing. It can be either a Script, a LocalScript, or a ModuleScript. This variable is not available when executing code from Roblox Studio's command bar.
| Field | Value |
|---|---|
| type | LuaSourceContainer |
workspace
A reference to the Workspace service, which contains all of the physical components of a Roblox world.
| Field | Value |
|---|---|
| type | Workspace |
Functions
| Name | Type / Returns | Description |
|---|---|---|
| delay | () | Schedules a function to be called on the next Heartbeat after the given duration (in seconds) has passed, with throttling. |
| DebuggerManager | DebuggerManager | Refers to the legacy DebuggerManager class which acts as an interface for the Luau debugger feature. |
| elapsedTime | number | Returns the amount of time in seconds that the current instance of Roblox has been running for. |
| PluginManager | PluginManager | Refers to the PluginManager, a deprecated singleton that was previously required to create plugins. |
| printidentity | () | Prints "Current identity is X", where X corresponds to the current thread's security context level. |
| settings | GlobalSettings | Returns the GlobalSettings object, which can be used to access settings objects that configure Roblox Studio's behavior. |
| spawn | () | Calls a function immediately through the engine scheduler, with throttling. |
| stats | Stats | Returns the Stats service. |
| tick | number | Returns the amount of time in seconds since the Unix epoch according to this device's time. |
| time | number | Returns the amount of time in seconds that has elapsed since the current game instance started running. |
| typeof | string | Returns the type of the given object as a string, also supporting Roblox-specific types (e.g. Vector3). |
| UserSettings | UserSettings | Returns the UserSettings object, which is used to read information from the current user's game menu settings. |
| version | string | Returns the current version of Roblox as a string, which includes the generation, version, patch and commit. |
| wait | number, number | Yields the current thread until the specified amount of time in seconds have elapsed, with throttling. |
| warn | () | Behaves similarly to print, except with more distinct formatting (yellow); intended for messages which describe potential problems. |
| ypcall | bool, Variant | Legacy function to work around an old task scheduling limitation of LuaGlobals.pcall(). |
delay
Deprecated. This method has been superseded by task.delay() and should not be used for future work.
Schedules a function to be executed after delayTime seconds have passed, without yielding the current thread. This function allows multiple Luau threads to be executed in parallel from the same stack. The delay will have a minimum duration of 29 milliseconds, but this minimum may be higher depending on the target framerate and various throttling conditions. If the delayTime parameter is not specified, the minimum duration will be used.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| delayTime | number | The amount of time that this function will be queued before being executed. | |
| callback | function | The function that will be executed once delayTime seconds have passed. |
Returns
| Type | Description |
|---|---|
| () |
| Field | Value |
|---|---|
| tags | ["Deprecated"] |
DebuggerManager
Deprecated. The DebuggerManager is obsolete and serves little to no use case for developers.
Returns the legacy DebuggerManager class which acts as an interface for Roblox's Luau debugger feature.
This function is not recognized by Luau's analysis tool and will raise an undefined global warning.
Returns
| Type | Description |
|---|---|
| DebuggerManager | The DebuggerManager singleton instance. |
| Field | Value |
|---|---|
| tags | ["Deprecated"] |
elapsedTime
Deprecated.
Returns how much time has elapsed since the current instance of Roblox was started. In Roblox Studio, this begins counting up from the moment Roblox Studio starts running, not just when opening a place.
Returns
| Type | Description |
|---|---|
| number | The elapsed time, in seconds, since the current Roblox instance started running. |
| Field | Value |
|---|---|
| tags | ["Deprecated"] |
PluginManager
Returns the PluginManager which is a deprecated singleton that was previously required to create plugins. It still has some applicable uses, such as if you need to create a Plugin object from Studio's Command Bar.
Returns
| Type | Description |
|---|---|
| PluginManager | The PluginManager singleton instance. |
printidentity
Deprecated.
Prints Current identity is [ID] to the output, where [ID] corresponds to the current thread's security context level.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| prefix | string | Current identity is | A custom string to print before the identity number; if omitted, defaults to "Current identity is". |
Returns
| Type | Description |
|---|---|
| () |
| Field | Value |
|---|---|
| tags | ["Deprecated"] |
settings
Returns the GlobalSettings object, which can be used to access the settings objects that are used in Roblox Studio's settings menu.
Returns
| Type | Description |
|---|---|
| GlobalSettings | The GlobalSettings singleton used to access Roblox Studio's settings objects. |
spawn
Deprecated. This method has been superseded by task.spawn() and should not be used for future work.
Runs the specified callback function in a separate thread, without yielding the current thread.
The function will be executed the next time Roblox's Task Scheduler runs an update cycle. This delay will take at least 29 milliseconds but can arbitrarily take longer, depending on the target framerate and various throttling conditions.
The callback function is invoked with two arguments:
- The first being the amount of time which elapsed from when spawn was called to when the function was invoked.
- The second being equivalent to elapsedTime() or roughly how long the engine has been running.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| callback | function | The function that will be executed. |
Returns
| Type | Description |
|---|---|
| () |
| Field | Value |
|---|---|
| tags | ["Deprecated"] |
Code samples: View on Creator Hub (RobloxGlobals-spawn).
stats
Deprecated.
Returns the Stats service. It is preferred that developers use ServiceProvider:GetService() to retrieve it instead.
Returns
| Type | Description |
|---|---|
| Stats | The Stats service instance. |
| Field | Value |
|---|---|
| tags | ["Deprecated"] |
tick
Returns how much time has elapsed, in seconds, since the Unix epoch, on the current local session's computer. The Unix epoch is represented by 00:00:00 on 1 January 1970.
tick() isn't officially deprecated, but has a variety of issues. It can be off by up to one second and returns inconsistent results across time zones and operating systems. Use os.time(), os.clock(), or RobloxGlobals.time() instead. Also consider DateTime.UnixTimestamp and DateTime.UnixTimestampMillis.
Returns
| Type | Description |
|---|---|
| number | The elapsed time, in seconds, since the Unix epoch (January 1, 1970) according to the local device clock. |
time
Returns the amount of time, in seconds, that has elapsed since the current game instance started running. If the current game instance is not running, this will be 0.
If Workspace.AuthorityMode is AuthorityMode.Server, this value is synchronized between client and server.
Returns
| Type | Description |
|---|---|
| number | The elapsed time, in seconds, since the current game instance started running. |
typeof
Returns the type of the object specified, as a string. This function is more accurate than Luau's native type function, as it does not denote Roblox-specific types as userdata.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| object | Variant | The Luau type that will have its type checked. |
Returns
| Type | Description |
|---|---|
| string | A string representation of the object's type, including Roblox-specific types such as "Vector3" or "CFrame". |
UserSettings
Returns the UserSettings object, which is used to read information from the current user's game menu settings.
Returns
| Type | Description |
|---|---|
| UserSettings | The UserSettings singleton instance. |
version
Deprecated.
Returns the current version of Roblox as a string. The integers in the version string are separated by periods, and each integers represent the following, in order:
- Generation - The current generation of the application shell that is hosting the client.
- Version - The current release version of Roblox.
- Patch - The current patch number for this version of Roblox.
- Commit - The ID of the last internal commit that was accepted into this version of the client.
Returns
| Type | Description |
|---|---|
| string | A period-separated version string in the format "generation.version.patch.commit". |
| Field | Value |
|---|---|
| tags | ["Deprecated"] |
wait
Deprecated. This method has been superseded by task.wait() and should not be used for future work.
Yields the current thread until the specified amount of seconds have elapsed.
The delay will have a minimum duration of 29 milliseconds, but this minimum may be higher depending on the target framerate and various throttling conditions. If the seconds parameter is not specified, the minimum duration will be used. This function returns:
- Actual time yielded (in seconds).
- Total time since the software was initialized (in seconds).
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| seconds | number | 0.03 | Specifies how long the thread should yield for. |
Returns
| Type | Description |
|---|---|
| number | The actual time yielded, in seconds. |
| number | The total time elapsed since the engine started, in seconds. |
| Field | Value |
|---|---|
| tags | ["Deprecated"] |
warn
Behaves identically to Luau's print function, except the output is styled as a warning, with yellow text and a timestamp. This function accepts any number of arguments, and will attempt to convert them into strings which will then be joined together with spaces between them.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| params | Tuple | This function accepts any number of arguments, and will attempt to convert them into strings which will then be joined together with spaces between them. |
Returns
| Type | Description |
|---|---|
| () |
ypcall
Deprecated.
Legacy function to work around an old task scheduling limitation of LuaGlobals.pcall(); should not be used for new work (use LuaGlobals.pcall() instead).
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| f | function | The function to be called in protected mode. | |
| args | Tuple | Additional arguments to pass to the function. |
Returns
| Type | Description |
|---|---|
| bool | Whether the function executed successfully without raising an error. |
| Variant | The return values of the function on success, or the error message on failure. |
| Field | Value |
|---|---|
| tags | ["Deprecated"] |