This article is a portal for reference articles for scripting in Roblox. If you want beginner tutorials instead, go to the Lua Help page.
Roblox uses Lua 5.1, a simple scripting language that can be embedded into games or programs (parent applications). Roblox developers have added in functionality to Lua so that users can create interactive content, like tools, buttons, leaderboards, and more in their places. The following links will give you an overview on the language.
The Roblox Wiki offers many tutorials for learning to use Lua in Roblox and using the Roblox studio.
An environment can be described as a place where variables live. Each script has its own environment.
A library is a group of functions that can be used to make scripting easier. For security purposes, some functions have been removed from Roblox to prevent access to system resources. Roblox loads the coroutine, string, table, math, and basic function libraries.
In addition, there are some libraries that ROBLOX developers have created for use by scripters.
One important feature that all programming languages use is math. For more information, and usage, read the following articles:
All values in Lua have their own type. These values can be stored in variables, passed as arguments to other functions, and returned as results.
Every value in Lua will be one of the following types:
These are some of the most commonly used special types created by and available only in Roblox.
Roblox defines the following global variables along with many others. See the Function Dump page for a list of global functions and read on for a list of global objects. Users can create their own Global Functions for use in individual games by making use of the global table.
gameis a reference to the DataModel instance that is the root of the object hierarchy.
workspaceis a shortcut for the Workspace instance that is a child of the DataModel.
scriptis a reference to the Script instance that is the owner of the referencing code. (Not applicable to Command Bar or plugins.)
Objects are what make Roblox work. Everything seen in-game is an object, as well as everything visible in the Explorer panel. All Objects have properties, methods and events. For information about certain objects, search the wiki for the specific object or go to the Class Reference page. Additionally, you can use the Object Browser for a more complete list of objects.
The slightest misspelling, or even incorrect capitalization will result in your script failing to work. Remember: Look at the output to check for errors. If this doesn't help, back-track and make sure everything is perfect. If you think there is a problem, or you need help in general, request help on the forum.
In the beginning:...