9 min read

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

NameType / ReturnsDescription
EnumEnumsContains all Enum objects.
gameDataModelRefers to the DataModel singleton, the root instance of a place's hierarchy.
pluginPluginRefers to a Plugin singleton when the code is run in the context of a Studio plugin.
sharedArrayA table shared between all code running at the same execution context level.
scriptLuaSourceContainerA reference to the LuaSourceContainer object (Script, LocalScript, or ModuleScript) that is executing this code.
workspaceWorkspaceA 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.

FieldValue
typeEnums

game

A reference to the DataModel, which is the root Instance of Roblox's parent/child hierarchy.

FieldValue
typeDataModel

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.

FieldValue
typePlugin

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.

FieldValue
typeArray

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.

FieldValue
typeLuaSourceContainer

workspace

A reference to the Workspace service, which contains all of the physical components of a Roblox world.

FieldValue
typeWorkspace

Functions

NameType / ReturnsDescription
delay()Schedules a function to be called on the next Heartbeat after the given duration (in seconds) has passed, with throttling.
DebuggerManagerDebuggerManagerRefers to the legacy DebuggerManager class which acts as an interface for the Luau debugger feature.
elapsedTimenumberReturns the amount of time in seconds that the current instance of Roblox has been running for.
PluginManagerPluginManagerRefers 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.
settingsGlobalSettingsReturns 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.
statsStatsReturns the Stats service.
ticknumberReturns the amount of time in seconds since the Unix epoch according to this device's time.
timenumberReturns the amount of time in seconds that has elapsed since the current game instance started running.
typeofstringReturns the type of the given object as a string, also supporting Roblox-specific types (e.g. Vector3).
UserSettingsUserSettingsReturns the UserSettings object, which is used to read information from the current user's game menu settings.
versionstringReturns the current version of Roblox as a string, which includes the generation, version, patch and commit.
waitnumber, numberYields 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.
ypcallbool, VariantLegacy 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

NameTypeDefaultDescription
delayTimenumberThe amount of time that this function will be queued before being executed.
callbackfunctionThe function that will be executed once delayTime seconds have passed.

Returns

TypeDescription
()
FieldValue
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

TypeDescription
DebuggerManagerThe DebuggerManager singleton instance.
FieldValue
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

TypeDescription
numberThe elapsed time, in seconds, since the current Roblox instance started running.
FieldValue
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

TypeDescription
PluginManagerThe 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

NameTypeDefaultDescription
prefixstringCurrent identity isA custom string to print before the identity number; if omitted, defaults to "Current identity is".

Returns

TypeDescription
()
FieldValue
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

TypeDescription
GlobalSettingsThe 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:

  1. The first being the amount of time which elapsed from when spawn was called to when the function was invoked.
  2. The second being equivalent to elapsedTime() or roughly how long the engine has been running.

Parameters

NameTypeDefaultDescription
callbackfunctionThe function that will be executed.

Returns

TypeDescription
()
FieldValue
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

TypeDescription
StatsThe Stats service instance.
FieldValue
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

TypeDescription
numberThe 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

TypeDescription
numberThe 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

NameTypeDefaultDescription
objectVariantThe Luau type that will have its type checked.

Returns

TypeDescription
stringA 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

TypeDescription
UserSettingsThe 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:

Returns

TypeDescription
stringA period-separated version string in the format "generation.version.patch.commit".
FieldValue
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:

Parameters

NameTypeDefaultDescription
secondsnumber0.03Specifies how long the thread should yield for.

Returns

TypeDescription
numberThe actual time yielded, in seconds.
numberThe total time elapsed since the engine started, in seconds.
FieldValue
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

NameTypeDefaultDescription
paramsTupleThis 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

TypeDescription
()

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

NameTypeDefaultDescription
ffunctionThe function to be called in protected mode.
argsTupleAdditional arguments to pass to the function.

Returns

TypeDescription
boolWhether the function executed successfully without raising an error.
VariantThe return values of the function on success, or the error message on failure.
FieldValue
tags["Deprecated"]