Roblox globals

Show Deprecated

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.

  • typeof(object : Variant):string

    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.

  • warn(params : Tuple):void

    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

elapsedTime

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

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 the GlobalSettings object, which can be used to access the settings objects that are used in Roblox Studio's settings menu.

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 the date January 1st, 1970.

Returns

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.

Returns

typeof

Returns the type of the object specified, as a string. This function is more accurate than Lua's native type function, as it does not denote Roblox-specific types as userdata.

Parameters

object: Variant

The Lua type that will have its type checked.

Returns

UserSettings

Returns the UserSettings object, which is used to read information from the current user's game menu settings.

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

void

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

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

void

Properties

Enum

A reference to the Enums data type, which stores all of the available enums that can be used on Roblox.

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

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

shared

A table that is shared across all scripts that share the same execution context level. This serves the exact same purpose as _G.

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.

workspace

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