Coding With Lua Cheatsheet: Create New Scripts Run Code
Coding With Lua Cheatsheet: Create New Scripts Run Code
Coding With Lua Cheatsheet: Create New Scripts Run Code
Variables
Placeholders for information the program will use later. Variables can be changed and worked
with in a variety of ways.
Properties
Any characteristic of an object.
Examples include color, visibility, speed, and health points.
Dot notation
Used to separate names of objects, properties, and keywords like “new”.
Example: game.Workspace.PartName.BrickColor = BrickColor.new(“Color
name”)
Wait Function
Makes the program wait a number of seconds before going to the next line of code.
Example: wait(4)
local Variables
Use the keyword local and a name to create your own variable. No spaces in the name.
Example: local NameOfMyVariable = script.parent
script.Parent
Directs a script to its parent. Usually a part.
Example: local NameOfMyVariable = script.parent
Troubleshooting Steps
1. Look for red lines in the code and follow instructions
2. Check that capitalization matches exactly
3. Check for missing quotation marks or parentheses
4. Make sure there are no spaces in variable names
5. Make sure that necessary code isn’t commented out (green)
6. Have a few friends look at your code. Everyone needs fresh sets of eyes sometimes.