Learn Roblox Lua

Cards (64)

  • When starting to build a game in Roblox Studio, it can be overwhelming to understand how to script
  • Searching for how to script on Roblox can lead to confusion due to technical jargon in tutorial videos
  • Learning scripting can be challenging, but with guidance, it is achievable
  • Steps to learn scripting in Roblox Studio
    1. Open Roblox Studio and create a base plate
    2. Build a simple part in the game
    3. Insert a script into the part
    4. Define variables in the script
    5. Create a new part using scripting
    6. Set the parent of the new part
    7. Modify properties of the new part like transparency
    8. Test the script by running the game
    9. Experiment with different properties and settings
  • Variable
    A variable stores a value, such as an object, text, or number
  • Instance
    An object in Roblox Studio, like a part or GUI
  • String
    A line of text in scripting
  • Number
    A numerical value in scripting
  • Parent
    The object an item is inside of in Roblox Studio
  • Property
    A detail or characteristic of an object in Roblox Studio, like color or transparency
  • Boolean
    A data type that can be true or false, often used for checkboxes in Roblox Studio
  • Changing the transparency property of a part

    Part dot transparency equals 0.5
  • Setting the parent of a part
    Part dot parent equals game dot workspace
  • Turning off shadow casting for a part

    Part dot cast shadow equals false
  • Cast shadow is false
  • Heart dot cast shadow equals false
  • If a firm increases advertising then their demand curve shifts right. This increases the equilibrium price and quantity
  • Anchor
    If set to true, the part is stuck and cannot move
  • Script wait
    Wait for a specified amount of time before executing the next action
  • Task.wait
    Similar to script wait but allows the game to work at its own pace
  • Task.wait is preferred when exact timing is not crucial
  • Print
    Display a line of words or numbers in the output window of Roblox Studio
  • Print is useful for debugging code and marking specific events
  • Math operations
    Perform mathematical operations like addition, subtraction, multiplication, and division
  • 3 plus 3 equals 6
  • 3 times 3 equals 9
  • 3 divided by 3 equals 1
  • Functions
    Pieces of code that perform a specific action when called upon
  • Functions can take parameters and return values
  • Parameters are variables used within a function
  • Functions help avoid repetitive coding by allowing reuse of code
  • Function add 10 x adds 10 to the input x
  • Function add 10
    x is the first parameter, function adds 10 to x, creates variable y as x + 10, prints y, returns y
  • Comment
    You can write notes in scripts using two dashes to help remember what things do
  • Scope in functions
    Local variables and functions are limited to where they are defined, global variables and functions can be used throughout the script
  • Functions are powerful in scripting, and scope is an important concept
  • Global vs. Local functions
    Global functions can be used throughout the script, local functions are limited to where they are defined
  • If you add up marginal utility for each unit, you get total utility
  • If part is anchored, it changes color to red; if not, it prints 'part is unanchored'
  • If part's brick color is medium stone gray, it prints 'this is a gray part'