Beginning Vocabulary 1 Flashcards
Variable
A name associated with a value.
Local
The term local means that the variable is only going to be used in this part of the script.
Equal Sign
Used to set values of variables
script.Parent
script.Parent is used to find the part the script is located in.
Naming Variables
Lowercase with every first word being capitalized. (justLikeThis)
Function
A function is a named block of code that help you organize your code and use it in multiple places without writing it again.
How are properties accessed?
Using a dot notation
Calling a function
You can call a function by writing its name with parentheses next to it.
While loop
A while loop runs the code inside it for as long as the statement after while remains true.
What if a while loop needs to run forever?
The statement after while should just be true. (Also known a an while true loop)
Wait function
Makes the program wait a number of seconds before going to the next line of code Example wait(4)
Why do you never make a while true loop without including a wait function?
If you do this, your game will freeze because Studio would never have a chance to leave the loop and do anything else. (Also don’t test your game either)
Events
Events send out signals when specific things happen in the game. To fire an event is to send out a signal. You can connect to events to run functions when they fire.
Touched Event
A Touched event fires when something touches.
Function Parameters
Also known as placeholders passed through a function. Parameters are definitions of what a function expects to receive when it’s called. Parameter variables are used to import arguments into functions. Parameters are the names listed in the functions definition.
Argument
Unlike parameters, (placeholders) function arguments are the real values passed through the function.
Dot notation
Used to separate names of objects, properties, and keywords like “new” Example: game.Workspace.PartName.BrickColor = BrickColor.new (0.9, 0.8, 0.1)
Properties
Any characteristic of an object Examples: color, visibility, speed, health points
While true do
Loops the code between while true do and end over and over
Parents and children
The relationship between two objects. For example, If you put a script into a part the part becomes the parent of the script.
script.Parent
Directs a script to its parent. Usually a part.
String Variables
Holds groups of letters and/or numbers. Uses quotation marks.
Numerical Variables
Used to count things. Does not have quotation marks.
Print function
Displays text on the screen.