Creating a Script
Creating a Script
Coding is the process of creating instructions for computers to follow. Just like people use different languages such as English and Spanish, so do programs. Roblox uses the coding language Lua.
In Roblox, lines of Lua code are held in scripts. These scripts give the game sets of instructions on how to give players health points, create a rain of llamas, or anything else imaginable.
Discussion Topic - Introducing Coding »
Grab the student's attention by asking what they know about coding:
- Have a volunteer explain how they think code works.
- Have 2-3 students share examples of something they use everyday that needed coding, like an app or a website.
Teaching Tip - Coding with Lua Handout »
This lesson includes an optional handout. Before students start, introduce the handout and point out they can reference it if they have questions.
Creating New Scripts
You’ll create your first script in ServerScriptService, a special folder just for holding scripts. Placing scripts there makes them easier to find later.
- In the Explorer, hover over ServerScriptService to see the
- Click the
+and select Script. The script editor will open, but ignore that for a moment.
- Rename the script PracticeScript (Select the Script > Right-click > Rename). It’s important to name your scripts so you always know which is which.
Using the Script Editor
Whenever you create new scripts, the script editor will automatically open up. This is where you will type your code in.
To find the script next time you open up Roblox Studio, click on the name of the script above the game editor, or double-click the script’s name in the Explorer.
These documents are licensed by Roblox Corporation under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. Roblox, Powering Imagination, and Robux are trademarks of Roblox Corporation, registered in the United States and other countries.
Previous Creating Checkpoints Next String Variables