Roblox globals
Roblox has several unique built-in functions and variables in its Lua implementation. These are only found on Roblox and are not packaged by default with Lua.
Summary
Functions
Returns the amount of time in seconds that the current instance of Roblox has been running for.
Refers to the PluginManager, a deprecated singleton that was previously required to create plugins.
Returns the GlobalSettings object, which can be used to access settings objects that configure Roblox Studio's behavior.
Returns the amount of time in seconds since the Unix epoch according to this device's time.
Returns the amount of time in seconds that has elapsed since the current game instance started running.
Returns the type of the given object as a string, also supporting Roblox-specific types (e.g. Vector3).
Returns the UserSettings object, which is used to read information from the current user's game menu settings.
Returns the current version of Roblox as a string, which includes the generation, version, patch and commit.
Behaves similarly to print, except with more distinct formatting (yellow); intended for messages which describe potential problems.
Properties
Contains all Enum objects.
Refers to the DataModel singleton, the root instance of a place's hierarchy.
Refers to a Plugin singleton when the code is run in the context of a Studio plugin.
A table shared between all code running at the same execution context level.
A reference to the LuaSourceContainer object (Script, LocalScript, or ModuleScript) that is executing this code.
A reference to the Workspace service, which contains all of the physical components of a place.
Functions
PluginManager
Returns the PluginManager which is a deprecated singleton that was previously required to create plugins. It still has applicable uses, such as if you need to create a Plugin object from Roblox Studio's command bar.
Returns
settings
Returns the GlobalSettings object, which can be used to access the settings objects that are used in Roblox Studio's settings menu.
Returns
UserSettings
Returns the UserSettings object, which is used to read information from the current user's game menu settings.
Returns
version
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
warn
Behaves identically to Lua'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
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
Properties
Enum
A reference to the Enums data type, which stores all of the available enums that can be used on Roblox.
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.
assert(plugin, "This script must be run as a plugin!")-- Code beyond this point will execute only if the script is run as a plugin
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.